Пример #1
0
  bool Packet::CreateFromSocket (ClientSocket& socket)
  {
    if (!socket.Receive (*this))
      return false;

    type_ = ReadPacketType ();

    return true;
  }
void *ProcessReceive(void *arg)
{
    string  receiveMessage;
    ClientSocket *clientSocket = static_cast<ClientSocket *>(arg);
    while(!value_receive_exit){
        clientSocket->Receive(receiveMessage);
        if(receiveMessage == ""){
               continue;
        }
        cout << "Response from server: "<< receiveMessage << endl;
        if(receiveMessage == "server has received your file"){
              value_send_exit = 1;
              break;
        }
        //cout << "Response from server: "<< receiveMessage << endl;
        sleep(2);
    }
    pthread_exit(NULL);
    return NULL;
}