36 #ifndef __vpUDPServer_h__ 37 #define __vpUDPServer_h__ 39 #include <visp3/core/vpConfig.h> 41 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 42 #include <netinet/in.h> 43 #include <sys/socket.h> 44 #include <sys/types.h> 49 #include <visp3/core/vpException.h> 51 #define VP_MAX_UDP_PAYLOAD 508 198 vpUDPServer(
const std::string &hostname,
const int port);
201 int receive(std::string &msg,
const int timeoutMs = 0);
202 int receive(std::string &msg, std::string &hostInfo,
const int timeoutMs = 0);
203 int send(
const std::string &msg,
const std::string &hostname,
const int port);
206 char m_buf[VP_MAX_UDP_PAYLOAD];
207 struct sockaddr_in m_clientAddress;
209 struct sockaddr_in m_serverAddress;
210 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 211 int m_socketFileDescriptor;
213 SOCKET m_socketFileDescriptor;
217 void init(
const std::string &hostname,
const int port);
This class implements a basic (IPv4) User Datagram Protocol (UDP) server.