[En-Nut-Discussion] Telnet connection state check

Alexander Baranov baranov at intech21.com
Mon May 2 15:13:53 CEST 2005


I had to solve that very problem in Linux.  If your socket is nonblocking
and you read data from it, you get -1 if there is no data and you get 0 if
there is no communication. So, getting 0 you can detect the occasion when
the client had closed the session.
The keep alive packets do the same (as far as I understand) but the reaction
may delay e.g. for an hour.
Alexander

----- Original Message ----- 
From: "Brett Abbott" <Brett.Abbott at digital-telemetry.com>
To: "Ethernut User Chat (English)" <en-nut-discussion at egnite.de>
Sent: Saturday, April 30, 2005 7:35 PM
Subject: Re: [En-Nut-Discussion] Telnet connection state check


> Keep alive packets could be used.  These use sequence number-1 and most
> stacks simply absorb them.  Keep alive packets are optionally sent on a
> regular  basis if no traffic is passed through the connection  to keep
> comms and firewall links open.  Im unsure if NutOs has this built in.
>
> Brett
>
> Damian Slee wrote:
>
> >This is more an issue with TCP, if it isnt sending any data, then it
> >won't find out it is disconnected.  That is all data has been ACK'ed,
> >and there is no FIN packet received cause the cable is unplugged.  Image
> >talking on a telephone and someone cuts the cable.  The only way to
> >determine your disconnected is to say hello a couple of times with no
> >response.
> >
> >If for example your telnet app in ethernut was to send some data then
> >TCP would timeout retrying and close.
> >
> >Or you implement an inactivity timer in your ethernut app, to kill the
> >connection if no user input has been received in 30seconds for example.
> >
> >-----Original Message-----
> >From: en-nut-discussion-bounces at egnite.de
> >[mailto:en-nut-discussion-bounces at egnite.de] On Behalf Of Andrea
> >Cannavicci
> >Sent: Saturday, April 30, 2005 6:39 PM
> >To: Ethernut User Chat (English)
> >Subject: [En-Nut-Discussion] Telnet connection state check
> >
> >Hi,
> >
> >I'm using the ethernut tcp telnet connection.
> >All works fine but I need to check the connection status.
> >
> >In the particular case I have this situation.
> >
> >- I connect the telnet client from a remote pc
> >- I keep the connection alive for an undefinite time
> >- If the network go down (e.g. someone disconnect the pc ethernet cable
> >or cut the pc power off without disconnecting telnet connection)
> >   the ethernut board keep the connection active. When I try to connect
> >again the connection is refused.
> >   The only thing I can do is hardware reset of the ethernut board.
> >
> >How can I monitor the telnet connection to verify if the pc is still
> >connected or not?
> >In this case I have to disconnect the telnet client and to restart
> >listen for an incoming connection
> >
> >Thanks in advance
> >
> >_______________________________________________
> >En-Nut-Discussion mailing list
> >En-Nut-Discussion at egnite.de
> >http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
> >
> >_______________________________________________
> >En-Nut-Discussion mailing list
> >En-Nut-Discussion at egnite.de
> >http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
> >
> >
> >
> >
>
> -- 
> -----------------------------------------------------------------
> Brett Abbott, Managing Director, Digital Telemetry Limited
> Email: Brett.Abbott at digital-telemetry.com
> PO Box 24 036 Manners Street, Wellington, New Zealand
> Phone +64 (4) 5666-860  Mobile +64 (21) 656-144
> ------------------- Commercial in confidence --------------------
>
>
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>
>





More information about the En-Nut-Discussion mailing list