42 #include <visp/vpServer.h>
83 vpERROR_TRACE(
"vpServer::vpServer(const int &port_serv), cannot open socket." );
109 vpERROR_TRACE(
"vpServer::vpServer(const std::string &adress_serv,const int &port_serv), cannot open socket." );
115 adress = adress_serv;
134 closesocket( (
unsigned)
receptor_list[i].socketFileDescriptorReceptor );
156 std::cout <<
"Error id : " << bindResult << std::endl;
157 std::string errorMessage(
"vpServer::vpServer(), cannot bind to port" );
158 char posrtNumberString[32];
159 sprintf( posrtNumberString,
"%d", port );
161 errorMessage += posrtNumberString;
162 errorMessage +=
" The port may be already used.";
174 std::cout <<
"Failed to set socket signal option" << std::endl;
177 #endif // SO_NOSIGPIPE
185 std::cout <<
"Server ready" << std::endl;
247 printf(
"New client connected : %s\n", inet_ntoa(client.
receptorAddress.sin_addr));
257 int numbytes = recv(
receptor_list[i].socketFileDescriptorReceptor, &deco, 1, MSG_PEEK);
259 int numbytes = recv((
unsigned int)
receptor_list[i].socketFileDescriptorReceptor, &deco, 1, MSG_PEEK);
265 std::cout <<
"Disconnected : " << inet_ntoa(
receptor_list[i].receptorAddress.sin_addr) << std::endl;
socklen_t receptorAddressSize
fd_set readFileDescriptor
int socketFileDescriptorEmitter
void print(const char *id="")
bool checkForConnections()
This class represents a Transmission Control Protocol (TCP) network.
int socketFileDescriptorReceptor
std::vector< vpReceptor > receptor_list
struct sockaddr_in receptorAddress
struct sockaddr_in emitterAdress