python - Partial read from Socket.File.Read -
im coding python script connects remote server, , parses returned response. odd reason, 9 out of 10 times, once header read, script continues , returns before getting body of response. im no expert @ python, im code correct on python side of things. here code: class miniclient: "client support class simple internet protocols." def __init__(self, host, port): "connect internet server." self.sock = socket.socket(socket.af_inet, socket.sock_stream) self.sock.settimeout(30) try: self.sock.connect((host, port)) self.file = self.sock.makefile("rb") except socket.error, e: #if e[0] == 111: # print "connection refused server %s on port %d" % (host,port) raise def writeline(self, line): "send line server." try: # updated sendall resolve partial data transfer errors self.sock.sendall(line + crlf) # unbuffered write except socket.error, ...