02-24-2012, 05:31 AM
And this is my problem, how to send this lenght along a string? I think (but I am not sure), I can not send short and string at same time.
I am going to do like this:
send(sock, (char*)HANDSHAKE, 2, 0); /*HANDSHAKE = 0x02*/
send(sock, (char*)sLenght, 2, 0); /*sLenght is a short with string lenght*/
send(sock, "Chlorek", 7, 0");
I see server after recv() changes packets to integer, and it dectects chlorek (first character of it) as packet 99. What am I doing wrong? I am begginer sockets, so I really thanx you for trying to help me.
I am going to do like this:
send(sock, (char*)HANDSHAKE, 2, 0); /*HANDSHAKE = 0x02*/
send(sock, (char*)sLenght, 2, 0); /*sLenght is a short with string lenght*/
send(sock, "Chlorek", 7, 0");
I see server after recv() changes packets to integer, and it dectects chlorek (first character of it) as packet 99. What am I doing wrong? I am begginer sockets, so I really thanx you for trying to help me.