libmuscle.mcp.tcp_transport_client module

class libmuscle.mcp.tcp_transport_client.TcpTransportClient(location: str)[source]

Bases: libmuscle.mcp.transport_client.TransportClient

A client that connects to a TCPTransport server.

Create a TcpClient for a given location.

The client will connect to this location and be able to request messages from any instance and port represented by it.

Parameters

location – A location string for the peer.

call(request: bytes) bytes[source]

Send a request to the server and receive the response.

This is a blocking call.

Parameters

request – The request to send

Returns

The received response

static can_connect_to(location: str) bool[source]

Whether this client class can connect to the given location.

Parameters

location – The location to potentially connect to.

Returns

True iff this class can connect to this location.

close() None[source]

Closes this client.

This closes any connections this client has and/or performs other shutdown activities.