lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] lwip_write() returns -1 after few days uptime, or after mul


From: Иван
Subject: [lwip-users] lwip_write() returns -1 after few days uptime, or after multiple interface(cable) reconnections
Date: Tue, 26 Jul 2016 12:44:28 +0300

Hello.

I have met a problem with sockets interface. Application works fine and 
periodically sends UDP packets. But after 3-4 days it accidentally stops. I use 
BSD sockets interface. Function lwip_write() returns -1.   I tried to emulate 
this problem manually. I managed something. This problem could appear after 1 
or 100 Ethernet cable reconnections. Once lwip_write() returned -1, socket 
would never became working. 
During my tries to fix I think I found the solution: reconnect sock. This 
solution-workaround is not well-tested yet.

            ret = write(sock, qe.pdata, send_len );
                        if( ret != send_len ){
                                // Wait for netif up if problem is with it.
                                while( !netif_is_up(netif_default)  ||  
!netif_is_link_up(netif_default) ){
                                        vTaskDelay( ms2ticks(1000) );
                                }
                                // reassociate udp socket with destination 
address and port
                                ret = connect(sock, (struct sockaddr*)&addr, 
sizeof(addr));
                        }

I have never met such troubles with netconn or raw interface.
LwIP version 1.4.1.

Does anybody met the same problem or something similar? How have you fixed it? 
Any workaround?
Please help.

--
Best regards
Ivan Kuvaldin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]