Telnet "connection closed by foreign host"

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
Post Reply
User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Telnet "connection closed by foreign host"

Post by pythoncoder » Sat Oct 17, 2015 11:50 am

I'm getting this if I leave the WiPy at the REPL for any length of time. The WiPy is in the same room as the AP, 2-3 metres away. There are two other Linux systems using the AP, but both were idle while I was testing. Is there a timeout on the REPL standing idle?
Peter Hinch
Index to my micropython libraries.

User avatar
andrew
Posts: 22
Joined: Sun Aug 10, 2014 9:22 am

Re: Telnet "connection closed by foreign host"

Post by andrew » Sat Oct 17, 2015 12:02 pm

Is it after 5 minutes? That's what I'm seeing.

Andrew

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Telnet "connection closed by foreign host"

Post by danicampora » Sat Oct 17, 2015 12:05 pm

Hi Peter,

Yes there's a 5 minute timeout by default (to prevent half closed sockets). You can increase this timeout easily:

Code: Select all

import network
network.server_timeout(time_out_in_seconds) # min is 5 seconds, affects both telnet and FTP
The same function can also be used to get the current timeout...

Cheers,
Daniel

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Telnet "connection closed by foreign host"

Post by pythoncoder » Sat Oct 17, 2015 12:27 pm

Thanks :)
Peter Hinch
Index to my micropython libraries.

Online
User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Telnet "connection closed by foreign host"

Post by Roberthh » Wed Oct 21, 2015 3:54 pm

Looks like network.server_timeout() disappeared with todays update.
Instead there is something like network.server.timeout(), but giving a number as argument just results in an error. Any update on the API doc?

Regards

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Telnet "connection closed by foreign host"

Post by danicampora » Wed Oct 21, 2015 4:02 pm

Docs will be generated later today, along with the official release. Do

Code: Select all

from network import server
server = server(timeout=value_in_seconds)

Online
User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Telnet "connection closed by foreign host"

Post by Roberthh » Wed Oct 21, 2015 4:46 pm

Thank you very much for the fast reply. That works,

Post Reply