Thanks Simon, it's good to know that the code should work. Threadpriorities are: tcpip-thread (and all threads created by lwip I think) has a higher prio than the application thread. The telnet thread is not the only thread running, I have a thread handling changes in the network (link down, etc.) running and some threads not related to lwip at all. I'll modify my system to only launch the essential threads and retest. I better look into my porting layer to make sure my priority assignment-scheme is as sane as I think it is.
Thanks for the hints, I'll test some more and try to figure out what I have done wrong. /Åke -----Ursprungligt meddelande----- Från: lwip-users-bounces+ake.forslund=nibe...@nongnu.org [mailto:lwip-users-bounces+ake.forslund=nibe...@nongnu.org] För goldsi...@gmx.de Skickat: den 14 mars 2012 19:26 Till: Mailing list for lwIP users Ämne: Re: [lwip-users] Nonblocking sockets problem Åke Forslund wrote: > I see my mistake there, however even with code that is at least theoretically > sane I can't establish a connection. lwip_accept() always returns EWOULDBLOCK > for me. > > from socket debug: > lwip_accept(0)... > lwip_accept(0): returning EWOULDBLOCK > [Repeats forever] > > putty reports "Connection closed by remote host" followed by "Network error: > Software caused connection abort" or "Connection reset by Peer" I have pasted your code into test.c in the Win32 port from contrib, removed your application-specific code, checked the return value of lwip_accept() and I could successfully connect using telnet.exe provided with windows XP. If it's not working for you, that suggests a problem either in your port or in the client application, I guess... What are the thread priorities in your system? Are you sure there is only one thread active in lwIP at a time? Because that's the main difference between the blocking and your non-blocking version: the blocking version just sits there and waits for a callback that lets lwip_accept return, while the non-blocking version calls into tcpip_thread *very* often - if your threading is broken, there's a good chance this will be revealed by your way of using non-blocking sockets. Simon _______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users _______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users