i am not sure if i am in the right section.
the project that i m working on qnx reads analog inputs and then it should send the data by UDP.
when i m compiling the project, i get this error :
"undefined reference to “socket” "
but i have already included socket.h. I thought at first it could be a problem in the order of includes.
i also tried to add -lsocket in the linker (project->options).
here’s a part of my code :
sockd = socket(AF_INET, SOCK_DGRAM, 0); unsigned short int port = 20000; SendTo(sockd, (const char*)TargetHost, port,codec.msgBuffer, sizeof(codec.msgBuffer)+1);
int PCI6025E::SendTo(int sock, const char *host, unsigned short int port, const char *buffer, int size)
struct sockaddr_in addr;
struct hostent *hp ;
addr.sin_addr.s_addr = inet_addr((const char*)host); memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = port; return sendto(sock, buffer, size, 0, (struct sockaddr *)&addr, sizeof(addr));
If someone could help resolve this problem it will be very appreciated.