def sock_recvmsg(sock, size, timeout=0):
while True:
try:
return _recv_msg(sock,size,timeout)
except socket.timeout:
raise TimeoutError("connection timeout receiving")
except socket.error,x:
if x.args[0] == errno.EINTR or (hasattr(errno, 'WSAEINTR') and x.args[0] == errno.WSAEINTR):
# interrupted system call, just retry
continue
raise ConnectionClosedError('connection lost: %s' % x)
except SSLError,x:
raise ConnectionClosedError('connection lost: %s' % x)
# select the optimal recv() implementation
评论列表
文章目录