riaps.run.cltPort module

Client port class Created on Oct 10, 2016

@author: riaps

class riaps.run.cltPort.CltPort(parentComponent, portName, portSpec)[source]

Bases: DuplexConnPort

Client port is to access a server. Has a request and a response message type, and uses a REQ socket.

closeSocket()[source]

Close down the port. Abstract, subclasses must implement this method.

getInfo()[source]

Retrieve relevant information about this port

getSocket()[source]

Return the socket of port

inSocket()[source]

Return False because the socket is not used as direct input (client has to recv explicitly)

recv()[source]

Receive a byte array (if possible) through the port

Used for receiving a message that is subsequently deserialized.

Returns:

a message packed into a bytes.

Return type:

bytes

recv_pyobj()[source]

Receive a Python data object (if possible) through the port. Abstract, subclasses must implement this method.

The raw message received is deserialized using pickle and returned. Messages received this way had to be sent using the send_pyobj method.

Returns:

a Python data object

Type:

any Python data type

reset()[source]

Reset the port object. Subclasses can override this method.

Reset is to be used when a send or receive operation fails and the port needs to be re-initialized.

send(msg)[source]

Send a byte array (if possible) out through the port.

Used for sending a message that has been serialized into bytes previously.

Parameters:

msg – the message packed into a bytes

Return type:

bytes

send_pyobj(msg)[source]

Send a Python data object (if possible) out through the port. Abstract, subclasses must implement this method.

The object is serialized using pickle and sent. Messages sent using this method are received using the recv_pyobj method.

Parameters:

msg (any Python data type) – the message to be sent.

setup()[source]

Set up the port

setupSocket(owner)[source]

Set up the socket of the port. Return a tuple suitable for querying the discovery service for the publishers