Class TCPClient

Class Documentation

class TCPClient

A synchronous TCPClient. Responsible to handle COLA2 TCP sessions.

Public Functions

TCPClient(sick::types::ip_address_t server_ip, sick::types::port_t server_port)

Constructor of a TCPClient object.

Parameters
  • server_ip – The IP address of the server to connect to.

  • server_port – The target port on the server to connect to.

TCPClient() = delete
TCPClient(const TCPClient&) = delete
TCPClient &operator=(const TCPClient&) = delete
void connect(sick::types::time_duration_t timeout = boost::posix_time::seconds(5))

Etablishes a connection to the sensor via the IP and port as specified in the constructor.

Parameters

timeout – A timeout limit to establish a new connection.

void disconnect()

Disconnects this client from the sensor.

void send(const std::vector<uint8_t> &sendBuffer)

Sends a COLA2 command to the sensor. Does not wait for a reply.

Parameters

sendBuffer – A buffer which is required to contain a valid COLA 2 telegram.

bool isConnected()

Indicates whether the TCP socket is currently opened.

Returns

true Cola2 session is currently opened.

Returns

false Cola2 session is closed/invalid.

sick::datastructure::PacketBuffer receive(sick::types::time_duration_t timeout = boost::posix_time::seconds(5))

Wait and receive a COLA2 reply from the sensor.

Parameters

timeout – A timeout limit on the receive operation.

Returns

sick::datastructure::PacketBuffer