sockets: How to know when your data is sent

Sion Arrowsmith siona at chiark.greenend.org.uk
Tue Nov 9 11:34:04 EST 2004


Grant Edwards  <grante at visi.com> wrote:
>On 2004-11-09, Marc Ederis <mederis at hotmail.com> wrote:
>>  When I use the send function, it will
>> happily send a buffer of a megabyte and more in one shot. But
>> of course, the data is still in the network buffer... 
>>  [ ... ] The
>> problem is, how can I know when it's done?
>Under Linux, there is no way to tell.  IIRC, there's no way to
>tell under BSD either.  I actually wrote some kernel mode code
>once upon a time to provide an ioctl() that I could call from
>user space to find out when the data I had written to a socket
>was actually sent.

I may well be missing the point of the problem here, but wouldn't
just turning TCP_NODELAY on guarantee that send() won't return
until the last ACK has returned? And if you're not using TCP:

>The way to tell that data has been sent is to use an
>application-level protocol that acknowleges the data transferr.

applies in spades if you care about reliability.

-- 
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump



More information about the Python-list mailing list