libmuscle.mcp.tcp_transport_server module

class libmuscle.mcp.tcp_transport_server.TcpHandler(*args: Any, **kwargs: Any)[source]

Bases: BaseRequestHandler

Handler for MCP-over-TCP connections.

This is a Python handler for Python’s TCPServer, which forwards to the RequestHandler attached to the server.

There’s a small terminology issue here: Python calls an entire connection a request, so self.request actually refers to the current connection we’re servicing. We’re doing Remote Procedure Call over that, and we call every RPC call we receive from the client a request also.

finish() None[source]

Called when shutting down the thread?

handle() None[source]

Handles connections, one per call

class libmuscle.mcp.tcp_transport_server.TcpTransportServer(handler: RequestHandler, port: int = 0)[source]

Bases: TransportServer

A TransportServer that uses TCP to communicate.

close(graceful: bool = True) None[source]

Closes this server.

Waits for all sessions to be closed by the clients, stops the server listening, waits for existing handlers to close, then frees any other resources.

Parameters:

graceful – Wait for clients to finish their sessions, where applicable.

get_location() str[source]

Returns the location this server listens on.

Returns:

A string containing the location.

class libmuscle.mcp.tcp_transport_server.TcpTransportServerImpl(host_port_tuple: tuple[str, int], streamhandler: type, transport_server: TcpTransportServer)[source]

Bases: ThreadingMixIn, TCPServer

allow_reuse_address = True
daemon_threads = True