Class UdpConnection

Inheritance Relationships

Base Type

Class Documentation

class UdpConnection : public KUKA::FRI::IConnection

This class implements the IConnection interface using UDP sockets.

Public Functions

UdpConnection(unsigned int receiveTimeout = 0)

Constructor with an optional parameter for setting a receive timeout.

Parameters:

receiveTimeout – Timeout (in ms) for receiving a UDP message (0 = wait forever)

~UdpConnection()

Destructor.

virtual bool open(int port, const char *controllerAddress = NULL)

Open a connection to the KUKA Sunrise controller.

Parameters:
  • port – The port ID for the connection

  • controllerAddress – The IPv4 address of the KUKA Sunrise controller. If NULL, the FRI Client accepts connections from any address.

Returns:

True if connection was established, false otherwise

virtual void close()

Close a connection to the KUKA Sunrise controller.

virtual bool isOpen() const

Checks whether a connection to the KUKA Sunrise controller is established.

Returns:

True if connection is established

virtual int receive(char *buffer, int maxSize)

Receive a new FRI monitoring message from the KUKA Sunrise controller.

This method blocks until a new message arrives.

Parameters:
  • buffer – Pointer to the allocated buffer that will hold the FRI message

  • maxSize – Size in bytes of the allocated buffer

Returns:

Number of bytes received (0 when connection was terminated, negative in case of errors or receive timeout)

virtual bool send(const char *buffer, int size)

Send a new FRI command message to the KUKA Sunrise controller.

Parameters:
  • buffer – Pointer to the buffer holding the FRI message

  • size – Size in bytes of the message to be send

Returns:

True if successful