34 #ifndef _vpUDPClient_h_
35 #define _vpUDPClient_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
177 vpUDPClient(
const std::string &hostname,
int port);
182 void init(
const std::string &hostname,
int port);
184 int receive(std::string &msg,
int timeoutMs = 0);
185 int receive(
void *msg,
size_t len,
int timeoutMs = 0);
186 int send(
const std::string &msg);
187 int send(
const void *msg,
size_t len);
194 char m_buf[VP_MAX_UDP_PAYLOAD];
195 struct sockaddr_in m_serverAddress;
197 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))
198 int m_socketFileDescriptor;
200 SOCKET m_socketFileDescriptor;
This class implements a basic (IPv4) User Datagram Protocol (UDP) client.