Clash
June 8th, 2007, 08:55 AM
Err hi... it's me again. I did understand that sometimes packets will come together, but what I'm not understanding is that it's saying I received 34 bytes, yet when I cout the packet it's only 12 bytes...
I took a screenshot:
http://xs216.xs.to/xs216/07235/wadahell2.png
Top part is the server, bottom is client
This is the format: (Packet) Received X Byes
You can notice that the 3 sent packets became 1 big one. The client says it received the big one, but when I cout it, it's only the first packet
Client code for receiving packets:
int kBufferSize = 1024;
char acReadBuffer[kBufferSize];
int nReadBytes;
do {
nReadBytes = recv(s, acReadBuffer, kBufferSize, 0);
if (nReadBytes > 0) {
hasNewData = true;
cout << "(" << acReadBuffer << ") Received " << nReadBytes << " bytes \n";
levelCommands->interpretatePackets(acReadBuffer);
}
else if (nReadBytes == SOCKET_ERROR) {
return false;
}
} while (nReadBytes != 0);
Do you guys need any other part of the code?
Thanks!
I took a screenshot:
http://xs216.xs.to/xs216/07235/wadahell2.png
Top part is the server, bottom is client
This is the format: (Packet) Received X Byes
You can notice that the 3 sent packets became 1 big one. The client says it received the big one, but when I cout it, it's only the first packet
Client code for receiving packets:
int kBufferSize = 1024;
char acReadBuffer[kBufferSize];
int nReadBytes;
do {
nReadBytes = recv(s, acReadBuffer, kBufferSize, 0);
if (nReadBytes > 0) {
hasNewData = true;
cout << "(" << acReadBuffer << ") Received " << nReadBytes << " bytes \n";
levelCommands->interpretatePackets(acReadBuffer);
}
else if (nReadBytes == SOCKET_ERROR) {
return false;
}
} while (nReadBytes != 0);
Do you guys need any other part of the code?
Thanks!