I am fighting since three days with the TCP/IP stack (V1.3). Before reporting any bug, I prefer to submit to you all what I have seen.
I am trying to open four UDP listening sockets, using the following basic code :
Code: Select all
xtcp_listen (tcp_svr, 5003, XTCP_PROTOCOL_UDP);
xtcp_listen (tcp_svr, 5004, XTCP_PROTOCOL_UDP);
xtcp_listen (tcp_svr, 5005, XTCP_PROTOCOL_UDP);
xtcp_listen (tcp_svr, 5006, XTCP_PROTOCOL_UDP);
xtcp_ask_for_event(tcp_svr); // Check for initial event from xtcp server
while(1) {
select
{
case xtcp_event(tcp_svr, conn):
UDP_HandleEvent(tcp_svr, conn);
xtcp_ask_for_event(tcp_svr);
break;
}
}
}
What is strange is that I see only two connection indications. And sometimes, I get immediately a report that I got a XTCP_CLOSED event.
More strange : only two listeners are created each time. If I send data using UDP to them, the XC2 receives it. But the two other ports do not receive anything.
Thus, I have activated a trace in the uip_xtcp.c file and I see that my application correctly sends the four listening requests.
Then I looked inside uip_process() function, where the UDP packets are processed. I found the following debug code, that I activated
Code: Select all
UIP_LOG("udp: no matching connection found");
printintln(HTONS(UDPBUF->srcport));
printintln(HTONS(UDPBUF->destport));
I checked the code within the listener creation function, and it follows exactly the suggestion coming from Adam Dunkels (the author of uIP). What frighten me is the comment he made on the uIP mailing list "It is possible to create a listening UDP connection in uIP, but it is a little tricky... If you have a cleaner solution, please post it for acception into uIP code" :o
As far as I can see, the TCP support in XTCP is perfect, but UDP is not very good.
Did somebody else experienced the same problems ?
I will look today in the uIP code, to try to understand why the listeners are not created properly (it seems to come clearly from uIP, not from XMOS port)
Note that if I try to open only one UDP socket, it works perfectly. The problem occurs as soon as I try to create more than one listener
Thanks to all by advance
Benoît