Go Down

Topic: Ethernet server release and accept new connection...? (Read 606 times) previous topic - next topic

I've been racking my brain trying to get this to work.
I have a lump of code that operates locally on the USB serial, and have extended that to replicate all the user menu functionality onto a port 23 'telnet' / raw socket using the EthernetServer() and EtherneClient() classes.

The code also runs another Ethernet() session calling out (ICMPping), which also runs perfectly.

Everything works perfectly - EXCEPT...
When a remote client connects for the FIRST time, all works fine,
Then disconnect which seems ok,
But it seems the he local socket is not released for another connection. 
If I reconnect from the remote client again, the server code doesn't do what I expect (and worked for the first connection),   the telnetClient object appears to be 'invalid' (perhaps retaining reference to the previously closed session?)

Any ideas - HELP!!!

Just to let everyone know -
I couldn't find a way to be notified or sure of a client drop or disconnect, so I'm checking traffic - and if nothing is sent or received for (60 secs), I close() the telnet session, and begin() again from the Arduino end.  It works, but seems clunky.

Go Up