5 ms·
sock.sendall() isn't the same as `sock.send(); sock.flush()` sendall will look something like: def sendall(sock, msg): totalsent = 0 MSGLE
by irahul 15y ago
sock.sendall() isn't the same as `sock.send(); sock.flush()`
sendall will look something like:
def sendall(sock, msg):
totalsent = 0
MSGLEN = len(msg)
while totalsent < MSGLEN:
sent = sock.send(msg[totalsent:])
if sent == 0:
raise RuntimeError("socket connection broken")
totalsent = totalsent + sent
- codeape 15y agoI don't use socket.send/flush. I use sockfile.write/flush.