See More

#include "server.h" Server::Server() { cout<<"Server () Top"<::iterator it=cars.begin(); it!=cars.end(); ++it) { // we need a reference... not a copy... sockets can't be copied // anyway sf::TcpSocket& client = **it; if (selector_car.isReady(client)) { char buff[200]; int size; size_t received_size; sf::Socket::Status status = client.receive(buff, sizeof(buff), received_size); if (status == sf::Socket::Done) { buff[received_size] = '\0'; cout << "message: " << buff << endl; //deal with the receiving message Packet recieved(buff); Packet response; cout<<"----recieved-----"<send(CON_CAR_TURN_LIGHT_ON, strlen(CON_CAR_TURN_LIGHT_ON)+1); ErrorHandling(checking); //wait for car to say light on checking = car->receive(received, 100, size); //deal with error received[size] = '\0'; ErrorHandling(checking); cout<<"before pacect assignment"<send(CON_CAM_REQ_POS, strlen(CON_CAM_REQ_POS)+1); cout<<"2 HandleLocationRequest: sent: "<isBlocking()){ cout<<"****blocking"<getLocalPort()<receive(cam_received, 100, size); cam_received[size] = '\0'; ErrorHandling(checking); cout<<"cam_received: "<send(str, strlen(str)+1); ErrorHandling(checking); //wait for car to say light on // checking = car->receive(received, 100, size); //deal with error // received[size] = '\0'; // ErrorHandling(checking); // cout<<"before pacect assignment"<