I've been having touble trying to get my head around how (UNIX) sockets actually send and receive an int or an int variable via a streaming socket.
I have a value (int px) and I have a socket (sa) and connect (c), and wish to send it from the server to the client. My understanding is that it goes something along these lines:
For the server:
Then I have in the client code:Code:send(sa, &px, sizeof(px), 0);
Though whatever I send (just an int) ends up casting a floating point exception to the client. Can anyone see where I'm going wrong, or offer some advice?Code:recv(c, &px, sizeof(px), 0)
Thanks in advance.