34 #ifndef _vpUDPServer_h_
35 #define _vpUDPServer_h_
37 #include <visp3/core/vpConfig.h>
40 #ifdef VISP_HAVE_FUNC_INET_NTOP
42 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))
43 #include <netinet/in.h>
44 #include <sys/socket.h>
45 #include <sys/types.h>
50 #include <visp3/core/vpException.h>
52 #define VP_MAX_UDP_PAYLOAD 508
206 vpUDPServer(
const std::string &hostname,
int port);
209 int receive(std::string &msg,
int timeoutMs = 0);
210 int receive(std::string &msg, std::string &hostInfo,
int timeoutMs = 0);
211 int send(
const std::string &msg,
const std::string &hostname,
int port);
214 char m_buf[VP_MAX_UDP_PAYLOAD];
215 struct sockaddr_in m_clientAddress;
217 struct sockaddr_in m_serverAddress;
218 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))
219 int m_socketFileDescriptor;
221 SOCKET m_socketFileDescriptor;
225 void init(
const std::string &hostname,
int port);
This class implements a basic (IPv4) User Datagram Protocol (UDP) server.