I've set up a tcp connection. I'd like to send an int over tcp.
Can you help me to do that ?
I've tried this, it doesn't work :
int i = 0;
send(sock, &i, sizeof(i), 0);
int i ;
recv(sock, &i, sizeof(i), 0);
I'd also like to send a structure. I think the client part is ok, but I'm having problems with the server.
My struct is composed of a char and a char (I know, it's not very clever but I'm just trying to understand how it works).
here is what i did :
recv( ear, &s, sizeof( structure ), 0 );
apparently s.char is received, but s.string acts weirdly : when I print its characters one by one, I find out that the string I sent only appears on the 4th char.
Do you see why this is, and how to fix it ?