Synchronous IPyC Reference

The following outlines clients and their methods for synchronous IPyC use.

Note

This module uses the Python logging module to log diagnostic and errors in an output independent way. If the logging module is not configured, these logs will not be output anywhere. See Setting Up Logging for more information on how to set up and use the logging module with IPyC.

IPyC Host

class ipyc.IPyCHost(ip_address: str = 'localhost', port: int = 9999)

Represents an abstracted synchronous socket listener that connects with and listens to IPyCClient clients. A number of options can be passed to the IPyCHost.

Parameters
  • ip_address (Optional[str]) – The IP address start listening on. This defaults to localhost.

  • port (Optional[int]) – The port the listener binds to. This defaults to 9999. Check your system to make sure this port is not used by another service. To use multiple IPyCHost hosts, ensure the ports are different between instantiations.

close()

Closes all IPyCLink connections and stops the internal listener.

property connections

Returns the set of all active IPyCLink connections the host is handling.

Type

set

is_closed()

bool: Indicates if the underlying socket listener is closed or no longer listening.

wait_for_client() → ipyc.links.IPyCLink

Starts listening for IPyCClient clients to connect.

Returns

The connection that has been established with a IPyCClient.

Return type

IPyCLink

IPyC Client

class ipyc.IPyCClient(ip_address: str = 'localhost', port: int = 9999)

Represents an abstracted synchronous socket client that connects to and communicates with IPyCHost hosts. A number of options can be passed to the IPyCClient.

Parameters
  • ip_address (Optional[str]) – The IP address to connect to. This defaults to localhost.

  • port (Optional[int]) – The port to target at the host IP address. This defaults to 9999.

close()

Closes the IPyCLink connection and stops the client connection.

connect() → ipyc.links.IPyCLink

A shorthand coroutine for asyncio.open_connection. Any arguments supplied are directly fed to that method. See the asyncio documentation for these arguments and their use.

Returns

The connection that has been established with a IPyCHost.

Return type

IPyCLink

property connections

Returns the set of all active IPyCLink connections the client is handling. The number of connections is always either one or none.

Type

set