A socket question

Jason Orendorff jason at jorendorff.com
Sat Jan 12 02:22:44 EST 2002


>   I am not really familiar with sockets.
> 
>   However I succeeded in creating a server and client. The client 
> requests a file that is sent by the server (the contents). On Linux, I 
> could use MSG_WAITALL option for recv to get all the data.
> 
>   Trying this on windows failed because it is not in the socket module 
> there. [...]

Suppose you have a socket variable "s".
Once the socket is already connected, you can do

  f = s.makefile('r')
  all_the_text = f.read()
  f.close()
  s.close()

## Jason Orendorff    http://www.jorendorff.com/







More information about the Python-list mailing list