36 #ifndef _vpUDPClient_h_ 37 #define _vpUDPClient_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__))) // UNIX 45 # include <netinet/in.h> 46 # include <sys/socket.h> 47 # include <sys/types.h> 49 # include <winsock2.h> 52 #include <visp3/core/vpException.h> 54 #define VP_MAX_UDP_PAYLOAD 508 172 vpUDPClient(
const std::string &hostname,
int port);
177 void init(
const std::string &hostname,
int port);
179 int receive(std::string &msg,
int timeoutMs = 0);
180 int receive(
void *msg,
size_t len,
int timeoutMs = 0);
181 int send(
const std::string &msg);
182 int send(
const void *msg,
size_t len);
189 char m_buf[VP_MAX_UDP_PAYLOAD];
190 struct sockaddr_in m_serverAddress;
192 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX 193 int m_socketFileDescriptor;
195 SOCKET m_socketFileDescriptor;
This class implements a basic (IPv4) User Datagram Protocol (UDP) client.