Getting one character at a time from sockets

Donn Cave donn at
Wed Feb 7 04:40:53 CET 2001

Quoth penman <pen_man at>:
| Using ordinary TCP/IP sockets with the socket module in Python, I need
| to get a single character at a time from the client; something
| like "talk" in unix. How could I do that? (should be platform
| independent if possible)
| recv(1) didn't work. It waited till the carriage return came in. (non-
| blocking didn't work either)

Don't mess around with non-blocking.  Even recv(8000) will return
more or less immediately if you send any data at all, so it seems
kind of likely you're sending no data until the CR.  Substitute a
test client that has its data built in, and just send('i') to the
server.  I bet recv() will get it right away, Nagel algorithms

	Donn Cave, donn at

More information about the Python-list mailing list