def create_socket(self, address=('', 0), reusable=True, listen=500): if (self._pipe): self.send('socket', address=address, reusable=reusable, listen=listen) fd = tradesocket.recv_fd(self._unix_socket.fileno()) if (fd < 0): raise RuntimeError("Error in tradesocket.recv_fd()") return socket.fromfd( fd, socket.AF_INET, socket.SOCK_STREAM ) else: return create_socket(address)
def create_socket(self, address): self.send('socket', address=address) fd = tradesocket.recv_fd(self._unix_socket.fileno()) if (fd == -1): raise RuntimeError("Error in recv_fd(), message length is negative.") if (fd == -2): raise RuntimeError("Error in recv_fd(), cmessage is null.") if (fd == -3): raise RuntimeError("Error in recv_fd(), cmessage is il-formed.") return socket.fromfd( fd, socket.AF_INET, socket.SOCK_STREAM )