Example of a TCP client/server.
#include <iostream>
#include <visp3/core/vpClient.h>
int main()
{
try {
std::string servername = "localhost";
unsigned int port = 35000;
int val = 0;
while(1)
{
if(client.
send(&val) !=
sizeof(int))
std::cout << "Error while sending" << std::endl;
else
std::cout << "Sending : " << val << std::endl;
if(client.
receive(&val) !=
sizeof(int))
std::cout << "Error while receiving" << std::endl;
else
std::cout << "Received : " << val << std::endl;
}
return 0;
}
std::cout << "Catch an exception: " << e << std::endl;
return 1;
}
}