I asked this question before and had no resolution (still having the problem). I am stumped because the function returned without error and NO DATA was sent! This code works on Linux ... the VxWorks version does not work (sendto does not send, though it returns without an ERROR).
The synopsis - I am writing a simple echo server - The server successfully receives the data (from an x86 box) and claims it successfully SENT it back. However NO DATA is received on the client (netcat on an x86). This code is running on VxWorks 5.4 on a PowerPC box ...
I is the UDP data being buffered somehow?
Could another task be preventing sendto from sending? (NOT to get off on a wild goose chase here, but I taskspawn my application with a normal priority, i.e. below critical tasks like the network task etc etc ... so this is fine).
Could VxWorks be buffering my UDP data?
I HAVE setup my routing table ... pinging works!
There is NO firewall AFAIK ...
What are the nuances of sendto and what would prevent my data from reaching the client ...
while(1) {
readlen = recvfrom(sock, buf, BUFLEN, 0, (struct sockaddr *) &client_address, &slen);
if (readlen == ERROR) { printf("RECVFROM FAILED()/n"); return (ERROR); }
printf("Received %d bytes FROM %s:%d\nData: %s\n\n", readlen, inet_ntoa(client_address.sin_addr), ntohs(client_address.sin_port), buf);
// Send it to right back to the client using the open UDP socket // but send it to OUTPORT client_address.sin_port = htons(OUTPORT);
// Remember slen is a value (not an address ... in, NOT in-out) sendlen = sendto(sock, buf, BUFLEN, 0, (struct sockaddr*)&client_address, slen);
// more code .... }
x