PDA

View Full Version : send() question


Anonymous
05-22-2003, 01:19 PM
I am using TCP protocol for sending data over the network. Can I be sure that after the send() call is over, the data is read by the other side? If not is there a way to achieve this?
The socket is not marked as blocking.
Thanks..

emihaly
05-22-2003, 02:09 PM
Yes. when is all ok, data was received by remote host. If not, send return error on next send usage.

check information how tcpip work. /packet scheme/
hope this help.

RobSeace
05-22-2003, 07:10 PM
You have no control over WHEN precisely TCP/IP will decide
to deliver your data to the other side... So, no, you can't ever
really be sure that any data you have sent has actually been
read by the other side, unless you design something into your
communication protocol to provide such notification... (Ie: have
each side send some kind of user-level ACK message after it
receives a message...) Well, actually, I take that back... I think
you could also get away with simply monitoring the amount of
unsent data in your send queue (via SIOCOUTQ/TIOCOUTQ
ioctl())... When that drops to zero, then yes, you can be sure
that all of the data has been received by the remote system...
HOWEVER, that doesn't necessarily mean it's been read by
the process on that remote system yet... It just means the OS
has successfully received it, and it's there waiting for the process
to read it, when it's ready to...

Anonymous
05-23-2003, 07:11 AM
Thanks, it's a very valuable information for me.