Hi, It seems that lwip_accept() blocks the calling thread even if the listening socket is set to non-blocking mode - see sample code below. Is it the normal behaviour or a bug? Winsock's accept() returns immediately for non-blocking sockets... As far as I debugged, it seems that sys_[arch_]mbox_fetch() waits forever or till the first connection. I'm using the Win32-port of LwIP 1.3.0, but this bug perhaps comes on other platforms as well. Maybe using sys_mbox_TRY_fetch would be more appropriate if FIONBIO is set, however I'm not familiar with using mailboxes in lwIP, therefore I would not dive deeper in the code if somebody can quickly tell me the right solution.
Thanks, Tamas Somogyi Example code: //create socket int s = lwip_socket(PF_INET, SOCK_STREAM, 0); //set to non-blocking mode int i = 1; lwip_ioctl(s, FIONBIO, &i); //listen lwip_listen(s, 0); //accept connection struct sockaddr addr; socklen_t l; int t = lwip_accept(s, &addr, &l); //lwip_accept doesn't return until an incoming connection happens _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
