def sendall(self, msg, flags=0, tries=0): _tries = tries = int(tries) if tries < 0: raise ValueError("trie must be >= 0") fd = int(self) msg_len = len(msg) sent = socket.send(fd, msg, flags) _sent = 0 while sent < msg_len: _sent = socket.send(fd, msg, flags) if not _sent: if not _tries: raise IncompleteWrite(fd, sent, tries) _tries -= 1 else: _tries = tries sent += _sent
def send_to(self, msg, to, flags=0): return socket.send(msg, to, flags)
def send(self, msg, flags): return socket.send(int(self), msg, flags)