Re: [lwip-users] UDP routing over IPv6?

2018-01-24 Thread Simon Goldschmidt
Barnabás Králik wrote:
> However, I still do not feel that my implementation is idiomatic (or at least 
> safe).
> What I did is to change the local_ip of the pcb before the udp_sendto call 
> then wrote
> back the original value. Do you have any better solution for sending an 
> answer?

Are udp_sendto_if() or udp_sendto_if_src() not working?

Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] Best way for determining if a TCP connection is dead?

2018-01-24 Thread goldsi...@gmx.de

On 24.01.2018 18:16, Joel Cunningham wrote:

On 01/24/2018 10:35 AM, Chris Seto wrote:

I have some code which works great, based on the echo client example.

I'm working on hardening it, and I'm wondering with how best to deal 
with a dead TCP connection as a result of the network link being down 
(ie, Ethernet cable disconnected).


This is a great source for dealing with half-open TCP connections due 
to all kinds of conditions:


https://www.codeproject.com/Articles/37490/Detection-of-Half-Open-Dropped-TCP-IP-Socket-Conne


To sum it up, you need to send packets over your TCP connection. The
preferred method is to write your application protocol in such way. Only
if this is not an option (e.g. existing protocol without such a feature,
backwards compatibility, etc.), you could use the tcp keepalive feature.
This is*not*  encouraged though! Unfortunately, a keepalive probe coming
through does*not*  necessarily/always mean data can flow.

Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] Best way for determining if a TCP connection is dead?

2018-01-24 Thread Joel Cunningham



On 01/24/2018 10:35 AM, Chris Seto wrote:

I have some code which works great, based on the echo client example.

I'm working on hardening it, and I'm wondering with how best to deal 
with a dead TCP connection as a result of the network link being down 
(ie, Ethernet cable disconnected).


This is a great source for dealing with half-open TCP connections due to 
all kinds of conditions:


https://www.codeproject.com/Articles/37490/Detection-of-Half-Open-Dropped-TCP-IP-Socket-Conne



The echo client contains conditions for a software termination of the 
socket (ie, server sends am empty frame), but I don't see anything 
dealing with a more blunt loss of the connection.


Any advice?

Thanks,
Chris


___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Joel

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] Best way for determining if a TCP connection is dead?

2018-01-24 Thread Stephen Cowell
I had to access my PHY chip to get the status of the line... using 1.4.1 
here on an Atmel SAME4E.


...
      gmac_enable_management(GMAC, true);
      gmac_phy_read(GMAC, BOARD_GMAC_PHY_ADDR, GMII_BMSR, _stat1);// 
get status from PHY

      gmac_enable_management(GMAC, false);

      if ((ul_stat1 & GMII_LINK_STATUS) == 0)
      {
          // do something...
      }
...

I'm using no OS (RAW) and doing this in main loop time... giant PITA.  
Also, it's possible for a bad phy_read() to return all 1's... in which 
case you won't see the disconnect... dealing with that one now.

__
Steve
.

Stephen Cowell
Project Manager/Engineer
Plasmability LLC
Office (512) 267-7087
Cell  (512) 632-8593
www.plasmability.com

On 1/24/2018 10:35 AM, Chris Seto wrote:

I have some code which works great, based on the echo client example.

I'm working on hardening it, and I'm wondering with how best to deal 
with a dead TCP connection as a result of the network link being down 
(ie, Ethernet cable disconnected).


The echo client contains conditions for a software termination of the 
socket (ie, server sends am empty frame), but I don't see anything 
dealing with a more blunt loss of the connection.


Any advice?

Thanks,
Chris


___
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

Re: [lwip-users] Best way for determining if a TCP connection is dead?

2018-01-24 Thread Chris Seto
Additionally, what is the best way to determine if a TCP connection failed
(ie, the server is down)?

It seems like the jump occurs between
// Fill in IP and connect
IP4_ADDR(, SERVER_ADDR0, SERVER_ADDR1, SERVER_ADDR2,
SERVER_ADDR3);
tcp_connect(appPcb, , SERVER_PORT, NetworkApp_connected);

and the NetworkApp_connected callback being called.

But what if the connected callback never is run? If I already have the
ability to poll, what should I watch for to indicate the connection never
went though?

Thanks

On Wed, Jan 24, 2018 at 10:35 AM, Chris Seto  wrote:

> I have some code which works great, based on the echo client example.
>
> I'm working on hardening it, and I'm wondering with how best to deal with
> a dead TCP connection as a result of the network link being down (ie,
> Ethernet cable disconnected).
>
> The echo client contains conditions for a software termination of the
> socket (ie, server sends am empty frame), but I don't see anything dealing
> with a more blunt loss of the connection.
>
> Any advice?
>
> Thanks,
> Chris
>
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

[lwip-users] Best way for determining if a TCP connection is dead?

2018-01-24 Thread Chris Seto
I have some code which works great, based on the echo client example.

I'm working on hardening it, and I'm wondering with how best to deal with a
dead TCP connection as a result of the network link being down (ie,
Ethernet cable disconnected).

The echo client contains conditions for a software termination of the
socket (ie, server sends am empty frame), but I don't see anything dealing
with a more blunt loss of the connection.

Any advice?

Thanks,
Chris
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users