Example of a TCP client/server.
#include <iostream>
#include <visp/vpServer.h>
int main()
{
try {
int port = 35000;
bool run = true;
int val;
while(run){
{
if(serv.
receive(&val) !=
sizeof(int))
std::cout << "Error while receiving" << std::endl;
else
std::cout << "Received : " << val << std::endl;
val = val+1;
if(serv.
send(&val) !=
sizeof(int))
std::cout << "Error while sending" << std::endl;
else
std::cout << "Sending : " << val << std::endl;
}
}
return 0;
}
std::cout << "Catch an exception: " << e << std::endl;
return 1;
}
}