There was an error while loading. Please reload this page.
1 parent c9f45c0 commit c0bb4bcCopy full SHA for c0bb4bc
1 file changed
Doc/howto/sockets.rst
@@ -199,11 +199,9 @@ length message::
199
def mysend(self, msg):
200
totalsent = 0
201
while totalsent < MSGLEN:
202
+ # No need to check for 0 here: send() raises OSError
203
+ # if the connection is broken.
204
sent = self.sock.send(msg[totalsent:])
- if sent == 0:
- raise RuntimeError("socket connection broken")
205
- # Note: in practice, send() on a broken connection
206
- # raises OSError rather than returning 0.
207
totalsent = totalsent + sent
208
209
def myreceive(self):
0 commit comments