libmuscle.mcp.tcp_server module

class libmuscle.mcp.tcp_server.TcpHandler(request, client_address, server)[source]

Bases: BaseRequestHandler

Handler for MCP-over-TCP connections.

handle() None[source]

Handles requests on a socket

receive_request() Optional[Reference][source]

Receives a request (receiver id).

Returns

The received receiver id.

class libmuscle.mcp.tcp_server.TcpServer(instance_id: Reference, post_office: PostOffice)[source]

Bases: Server

A server that accepts MCP connections over TCP.

Create a TCPServer.

Parameters
  • instance_id – Id of the instance we’re a server for.

  • post_office – A PostOffice to obtain data from.

close() None[source]

Closes this server.

Stops the server listening, waits for existing clients to disconnect, then frees any other resources.

get_location() str[source]

Returns the location this server listens on.

Returns

A string containing the location.

property post_office: PostOffice

Export this so the server thread can use it.

class libmuscle.mcp.tcp_server.TcpServerImpl(host_port_tuple: Tuple[str, int], streamhandler: Type, tcp_server: TcpServer)[source]

Bases: ThreadingMixIn, TCPServer

daemon_threads = True