Im trying to do a simple client tcp (I have a server already working). I have defined 2 variables:
std::vector<unsigned char> buffer(1000);
std::vector<std::vector<unsigned char>> buff;
buffer
I use it ot read chains of unsigned characters, when reading is done i store it onbuff
and I start reading again. I have defined all the process of adress, port, etc and when it comes to send strings ofbuffer
I have problems. Here's what i tried so far:while(!buff.empty()){ // Sockets Layer Call: send( n = send(sockfd, buff.back(), buff.back.size(), 0); std::this_thread::sleep_for(std::chrono::milliseconds(delay)) ; buff.pop_back(); if (n < 0){ std::cout<<"ERROR writting to socket"<<std::endl; exit(1); } }
I tried adding (char *)
, also reinterpret_cast
, but noithing seems to work. Any clue?
Thanks