Google buffers, boost serialize, xml, json are a lot of options in fact. That is, in fact, you just have to figure out how to store your structure of two fields in a row (as the simplest) and just send / receive this string over the network. Well and parser / parser write for this.
Client:
std::string sFileName = "..."; int nBlockSize = ...; std::stringstream output; output << sFilename <<" "<<nBlockSize; std::string sToSend = output.str(); send(my_socket, sToSend.c_str(), sToSend.size(), 0);
Server:
std::string sReceived(buffer,received_len); //buffer содержит то что мы прочитали из соккета. received_len - сколько прочитали из сокета). std::stringstream input(sReceive); std::string sFileName; int nBlockSize = 0; input >> sFileName; input >> nBlockSize;
Something like this. I am writing very roughly now, but the meaning is approximately clear, I hope.
sizeof( SIZE_T )
. - mega