Re: Asynchronous sock_sendmbuf
Re: Asynchronous sock_sendmbuf
- Subject: Re: Asynchronous sock_sendmbuf
- From: Michael Smith <email@hidden>
- Date: Tue, 20 May 2008 19:16:39 -0700
On May 20, 2008, at 9:06 AM, Rick Macklem wrote:
On Tue, 20 May 2008, Josh Graessley wrote:
When using sockets in the kernel or in user space, there is no way
to know, without polling, when the data has been sent. The send/
sendmbuf calls enqueue
As Josh notes, you can only tell when the data has been sent via
polling. There is also the issue of what you mean by "sent". Do you
only care that
the data has been sent on the wire, or that it has been successfully
received at the other end?
There are usually two questions that want to be answered:
- is there room to send more data?
This is the wrong question to ask. Try shoving more data into the
socket, and be prepared to block. By blocking, you effectively
increase the size of the socket buffer (since your blocked thread is
ready to push more in as soon as space is available).
- did the other end receive my data?
The *only* way to answer this question safely is to have your protocol
stack on the other end send you a message back. Even if your data
made it to the stack on the other end, there's no guarantee that it's
made it to the point where it can not be lost...
= Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden