Telnet and SO_LINGER

Donnal Walter donnal at donnal.net
Mon Feb 11 08:52:16 EST 2002


I am trying to use telnetlib.Telnet objects to communicate with two
different servers.

On one of the servers, the Telnet object works just fine off the
shelf, but on the other I keep getting
socket.error: (10054, 'Connection reset by peer').

I have a hunch that my problem may be related to one of the socket
options, specifically SO_LINGER, but from the documentation I cannot
quite figure out the syntax for changing it.

In the following method:
tn.get_socket().setsockopt(level, optname, value) 
what does the 'level' parameter refer to? Also, I presume that
'optname' is SO_LINGER (or 128), but what is the 'value'? Is it a
scalar or a tuple?

Donnal Walter
Arkansas Children's Hospital



More information about the Python-list mailing list