lwip-users
[Top][All Lists]
Advanced

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

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


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

I have create two similar tasks with two sockets. One works fine for a while, 
and another gives me an error in lwip_write().
Going through lwip_sendto() I found sock->conn->last_err is -15 (ERR_IF, 
Low-level netif error) and at the and of function sock->err becomes -1. It is 
strange because one socket works at this time and another not. Device responds 
to UDP requests, and it responds to ICMP(ping) requests. I fight with this 
problem not first day and it seems not easy to fix it. I think recreate socket 
is not good idea, but it could be solution.

-- 
Best regards
Ivan Kuvaldin


26.07.2016, 12:45, "Иван" <address@hidden>:
> 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
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users



reply via email to

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