I doubt it is a bug of either the receiving or sending code since when the client writes either one of the bytes (-112, -113, -115) the server receives it as 63, and the same happens vice versa (server sends one of those bytes to the client, and client receives it as 63).
Anyways, here is my server's send code:
Code:
int writef(sock *s, char *buff, int tosend)
{
int sent = 0;
while (sent != tosend) {
int _sent = send((SOCKET) *s, buff+sent, tosend-sent, 0);
if (_sent >= 0)
sent += _sent;
else
return SOCKET_ERROR;
}
return 0;
}
I invoke the method as follows:
Code:
char buff[2];
buff[0] = -112;
buff[1] = 5;
writef(&conn, buff, 2);
Here is my server's receive code:
Code:
char buff[512];
recv(conn, buff, 512, 0);
I am also inclined into thinking that this bug has to do with the server since when setting up a server written in Java, it all works well. I also do not believe it has anything to do with the byte's signedness since it receives other negative numbers perfectly fine.
Thanks again,
abraham2119