36#ifndef _vpUDPServer_h_
37#define _vpUDPServer_h_
39#include <visp3/core/vpConfig.h>
42#ifdef VISP_HAVE_FUNC_INET_NTOP
44#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))
45# include <netinet/in.h>
46# include <sys/socket.h>
47# include <sys/types.h>
52#include <visp3/core/vpException.h>
54#define VP_MAX_UDP_PAYLOAD 508
201 vpUDPServer(
const std::string &hostname,
int port);
204 int receive(std::string &msg,
int timeoutMs = 0);
205 int receive(std::string &msg, std::string &hostInfo,
int timeoutMs = 0);
206 int send(
const std::string &msg,
const std::string &hostname,
int port);
209 char m_buf[VP_MAX_UDP_PAYLOAD];
210 struct sockaddr_in m_clientAddress;
212 struct sockaddr_in m_serverAddress;
213#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))
214 int m_socketFileDescriptor;
216 SOCKET m_socketFileDescriptor;
220 void init(
const std::string &hostname,
int port);
This class implements a basic (IPv4) User Datagram Protocol (UDP) server.