|
-
October 8th, 2009, 05:06 AM
#1
send() and recv() parameters confusion
On server Side:
int recv (Socket,Buffer, Length, Flags)
On Client Side:
int send (Socket,Message, Length, Flags)
can anyone plz tell me weather the 1st parameter in both of above is the same thing or not??
if no .... plz tell me how to know that both the above commands are sending/receiving from same socket.
-
October 8th, 2009, 06:27 AM
#2
Re: send() and recv() parameters confusion
send( socket , , ,0);
recv( socket , , ,0);
if one of them is on client side and the other is on server side .... and on both side integer socket that I pass to these functions has same value ... can I say that this recv() is for respective send()
-
October 8th, 2009, 08:29 AM
#3
Re: send() and recv() parameters confusion
I'm not sure I understand your second question, but as to your first question, both send and recv are designed to handle any arbitrary bitstream. The Length parameter tells each how many bytes to send or to expect to be received. The return values of both send and recv should be checked to ensure that the entire amount has been sent/received and if not, should loop until it is. It is up to the programmer to ensure that the stream is correctly parsed/cast on each end of the transaction.
-
October 8th, 2009, 12:24 PM
#4
Re: send() and recv() parameters confusion
A socket connection is described by the 5-tupel (local IP address, local port, remote IP address, remote port, protocol).
So the server and client both have the same values to describe the connection, but in different order (wrt local/remote).
The "socket" itself is a resource descriptor, and its value can be anything meaningful to the underlying OS.
HTH,
Richard
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|