| Newsgroups |
gmane.comp.hardware.rabbit-semiconductor |
| Message-ID |
<[email protected]> |
I have an R6k application that uses UDP broadcast messaging. And it seems to work fine. On our R3000 products we also use UDP, and we also use Scott Henion's UDPDownload feature which also uses a UDP socket. I am trying add Scott's method of device identification to my R6k app. But I've been unable to get it to work.
I'm using 3 UDP sockets, on port 2100, for our system communication. The ID socket is on port 2000.
I have these defines.
#define UDP_BUF_SIZE 256
#define UDP_SOCKETS 3
#define MAX_UDP_SOCKET_BUFFERS 8
I open the ID socket the same way as the other sockets, it opens with no errors:
if ( !udp_extopen( &udp_dl_sock, IF_DEFAULT, 2000, -1, -1, NULL, 0, 0) ) {
printf("UDPDL-udp_open socket failed!\r\n");
return 1;
}
....
Then I check the socket for broadcast packets.
len = udp_recvfrom( &udp_dl_sock, buff, sizeof(buff), &ip, &port );
if ( len < 0 ) return;
I never get any packets.
Using Wireshark I see the broadcast UDP datagram being sent by the host. The datagram contains 8-bytes of data per Scott's format. All other devices see the datagram and respond accordingly. But not the R6k device.
I then added #defines UDP_DEBUG and UDP_VERBOSE, and set debug_on to 5, which generates lots of output. Running the same test, the UDP library prints out that it got the broadcast packet, and that's it. I never get it via udp_recvfrom(). Here is paste of the relevant printout showing that the packet was received. You can see the received packet near the middle at port 2000. Notice that it doesn't say "no applicable socket". So it did associate the datagram with the open socket.
UDP: got pkt 0AFA056B:137 -> 0AFA05FF:137 payload=50 i/f=0
UDP: no applicable socket
UDP: got pkt 0AFA0568:137 -> 0AFA05FF:137 payload=50 i/f=0
UDP: no applicable socket
UDP: got pkt 0AFA0535:59454 -> FFFFFFFF:1947 payload=40 i/f=0
UDP: no applicable socket
UDP: got pkt 0AFA0553:137 -> 0AFA05FF:137 payload=50 i/f=0
UDP: no applicable socket
UDP: got pkt 0AFA053E:58143 -> FFFFFFFF:2000 payload=8 i/f=0
UDP: got pkt 0AFA055E:137 -> 0AFA05FF:137 payload=50 i/f=0
UDP: no applicable socket
UDP: got pkt 0AFA056B:137 -> 0AFA05FF:137 payload=50 i/f=0
UDP: no applicable socket
UDP: got pkt 0AFA0568:137 -> 0AFA05FF:137 payload=50 i/f=0
UDP: no applicable socket
UDP: got pkt 0AFA0553:137 -> 0AFA05FF:137 payload=50 i/f=0
I'm at a loss as to how to proceed. Any suggestions?
Steve