Re: send & MSG_DONTWAIT
- From: Rainer Weikusat <rweikusat@xxxxxxxxxxx>
- Date: Wed, 16 Jul 2008 12:00:54 +0200
David Schwartz <davids@xxxxxxxxxxxxx> writes:
On Jul 15, 9:23 am, Rainer Weikusat <rweiku...@xxxxxxxxxxx> wrote:
The sending application has zero control regarding specifics of the
TCP transport and neither has the receiving application.
Right. That's why an "all or nothing" non-blocking send doesn't exist.
Giving applications that kind of control would allow them to break the
TCP protocol.
This call does not exist because the particulars of the transport are
handled by the transport protocol.
If the receiver wants to limit the window to one byte, such that the
sender can only send one byte at a time, there will be no
deadlock. There will only be a deadlock if the sender also refuses
to send a single byte.
Interactions among sending and receiving TCP happen inside the
TCP-implementations used on each end. But the question was about an
application using an existing TCP-implementation. If the sending
application wants to be able to 'send complete frames', it just needs
something like an acknowledgement from the receiving application that
the last 'complete frame' has been received and then, it can queue the
next 'complete frame', waiting for the next application ack from
remote before queueing any more data to send. That's stupid for bulk
data transfers, but completely possible.
It still can't send a complete frame with a non-blocking call.
If a frame is 348 bytes, when it calls 'write' or 'send', it's always
possible that the stack will take 124 bytes.
No, this is not 'always possible'. The buffer size is both know and
configurable and the state of the buffer is known by virtue of the
state of the application protocol, ie when the remote peer has
communicated that it has received all data sent so far, the local
buffer is necessarily empty.
More precisely, this is absolutely never possible, given the context
of the situation.
.
- Follow-Ups:
- Re: send & MSG_DONTWAIT
- From: Rainer Weikusat
- Re: send & MSG_DONTWAIT
- References:
- send & MSG_DONTWAIT
- From: Kyku
- Re: send & MSG_DONTWAIT
- From: Alex Fraser
- Re: send & MSG_DONTWAIT
- From: Kyku
- Re: send & MSG_DONTWAIT
- From: David Schwartz
- Re: send & MSG_DONTWAIT
- From: Kyku
- Re: send & MSG_DONTWAIT
- From: Barry Margolin
- Re: send & MSG_DONTWAIT
- From: Kyku
- Re: send & MSG_DONTWAIT
- From: David Schwartz
- Re: send & MSG_DONTWAIT
- From: Rainer Weikusat
- Re: send & MSG_DONTWAIT
- From: David Schwartz
- Re: send & MSG_DONTWAIT
- From: Rainer Weikusat
- Re: send & MSG_DONTWAIT
- From: David Schwartz
- send & MSG_DONTWAIT
- Prev by Date: Re: echo client using threads
- Next by Date: Re: Dynamic aligned memory allocation
- Previous by thread: Re: send & MSG_DONTWAIT
- Next by thread: Re: send & MSG_DONTWAIT
- Index(es):
Relevant Pages
|