def f(a, b): print("sub process", os.getpid()) try: print("size", b.qsize()) h = b.get() s = rebuild_socket(h, socket.AF_INET, socket.SOCK_STREAM, 0) # fd = rebuild_handle(h) # s = socket.fromfd(fd,socket.AF_INET,socket.SOCK_STREAM) s.send(b"1111") print(s) print(s.getsockname()) except Exception as e: print(e)
def f(a, b): print('sub process', os.getpid()) try: print('size', b.qsize()) h = b.get() s = rebuild_socket(h, socket.AF_INET, socket.SOCK_STREAM, 0) #fd = rebuild_handle(h) #s = socket.fromfd(fd,socket.AF_INET,socket.SOCK_STREAM) s.send(b'1111') print(s) print(s.getsockname()) except Exception as e: print(e)
def __init__(self, serialized_sock): """ Initializes ClientHandler with the socket contained in serialized_sock. Args: serialized_sock: A serialized socket connected to a client. """ # Deserialize the client socket from the input: self._client_socket = rebuild_socket(serialized_sock[0], serialized_sock[1], serialized_sock[2], serialized_sock[3]) # Initialize the connection state: self._connection_state = ProxyState.OPENING # Initialize a placeholder for the target socket: self._target_socket = None
def deserialise_socket(serialised): return reduction.rebuild_socket(*serialised)
def _socket(self, picklable): args = pickle.loads(picklable) sock = rebuild_socket(*args) self._class.socks.put(sock)