readlines() on a socket

Gregory Bond gnb at
Wed Oct 24 05:59:59 CEST 2001

I'd like to be able to do
	s = socket.socket(...)
	s = socket.connect(....)
	for l in s.readlines():
		# process line l

but sockets don't support readline(), or readlines(), or anything
similar that I can see.

Is there away to do this that doesn't involve manually calling split
on the results of s.recv() and worrying about whole lines split across
recv() calls?

More information about the Python-list mailing list