Node Communication

exception openlcb.communication.CommunicationException[source]

Raised if an error occurs while communicating with a node

class openlcb.communication.EthernetConnection(hostname, port)[source]

Class for communicating with nodes via Eth2CAN

Parameters:
  • hostname (str) – Host name or IP address of the Eth2CAN device
  • port (int) – TCP port of the Eth2CAN device
BUFFER_SIZE = 4096

Maximum amount of data to read from a response message (in bytes)

SOCKET_TIMEOUT = 1.0

Amount of time to wait for a response (in seconds)

close()[source]

Close the TCP/IP communication socket

connect()[source]

Connect to the Eth2CAN device over TCP/IP

receive()[source]

Retreive a response from the node

Returns str:A string containing the CAN message, suitable for creating a new instance of a CANMessage subclass

Deprecated since version 0.1: Use receive_one() instead

receive_multi()[source]

Retreive multiple responses from the node

Returns list:A list of strings containing CAN messages, suitable for creating new instances of a CANMessage subclass
receive_one()[source]

Retreive a single response message from the node

Returns str:A string containing the first message received, suitable for creating a new instance of a CANMessage subclass
send(message)[source]

Send a CAN message

Parameters:message (CANMessage) – An instance of a CANMessage containing the message to send

Previous topic

CAN Messages

This Page