Program Listing for File friUdpConnection.h
↰ Return to documentation for file (include/fri_client_sdk/friUdpConnection.h
)
#ifndef _KUKA_FRI_UDP_CONNECTION_H
#define _KUKA_FRI_UDP_CONNECTION_H
#include <cstdlib>
#ifdef _WIN32
#include <winsock2.h>
#else
// if linux or a other unix system is used, select uses the following include
#ifdef __unix__
#include <sys/select.h>
#endif
// for VxWorks
#ifdef VXWORKS
#include <selectLib.h>
#include <sockLib.h>
#endif
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
#include <fri_client_sdk/friConnectionIf.h>
namespace KUKA
{
namespace FRI
{
class UdpConnection : public IConnection
{
public:
UdpConnection(unsigned int receiveTimeout = 0);
~UdpConnection();
virtual bool open(int port, const char * controllerAddress = NULL);
virtual void close();
virtual bool isOpen() const;
virtual int receive(char * buffer, int maxSize);
virtual bool send(const char * buffer, int size);
private:
int _udpSock;
struct sockaddr_in _controllerAddr;
unsigned int _receiveTimeout;
fd_set _filedescriptor;
};
}
}
#endif // _KUKA_FRI_UDP_CONNECTION_H