do telnet-clients not connect() ?

Peter Hansen peter at engcorp.com
Sun Oct 1 17:45:07 EDT 2000


Alexander K wrote:
> 
> so, i open a socket like this:
> 
> -> s = socket(AF_INET, SOCK_STREAM)
> -> s.bind(hostname, port)
> -> s.listen(2)
> -> (peer, address) = s.accept()
> 
> so i telnetted to host:port to see if it accept() 'ed that.
> it didnt.
> after the telnetattempt i ran netstat and saw that s was still
> in LISTEN mode.
> 
> howcome?
> telnet communicates on TCP, right?

What hostname and port?  Ports on unix below 1024 are only accessible as
root, AFAIK.  Also, have you tried '127.0.0.1' or 'localhost' for the
hostname, which should always work when on the same machine you try to
telnet to that address.  Are you using the right command line arguments
for telnet?  It doesn't take host:port on my machine (FreeBSD 2.2.8),
but "telnet host port".  

Yes, telnet uses TCP.  Depending on what precisely you tried, it may or
may not work.  Doing the above (after "from socket import *") works on
my machine provided I use appropriate hostname and port settings...

-- 
Peter Hansen



More information about the Python-list mailing list