41 #include <visp3/core/vpClient.h>
45 #ifdef ENABLE_VISP_NAMESPACE
49 #ifdef VISP_HAVE_FUNC_INET_NTOP
51 std::string servername =
"localhost";
52 unsigned int port = 35000;
61 if (client.
send(&val) !=
sizeof(
int))
62 std::cout <<
"Error while sending" << std::endl;
64 std::cout <<
"Sending : " << val << std::endl;
66 if (client.
receive(&val) !=
sizeof(
int))
67 std::cout <<
"Error while receiving" << std::endl;
69 std::cout <<
"Received : " << val << std::endl;
74 std::cout <<
"Catch an exception: " << e << std::endl;
78 std::cout <<
"This test doesn't work on win XP where inet_ntop() is not available" << std::endl;
This class represents a Transmission Control Protocol (TCP) client.
bool connectToHostname(const std::string &hostname, const unsigned int &port_serv)
error that can be emitted by ViSP classes.
int send(T *object, const int unsigned &sizeOfObject=sizeof(T))
int receive(T *object, const unsigned int &sizeOfObject=sizeof(T))