sockets: How to know when your data is sent

Grant Edwards grante at visi.com
Tue Nov 9 10:30:07 EST 2004


On 2004-11-09, Marc Ederis <mederis at hotmail.com> wrote:

> I'm having a problem with sending data with sockets over a
> dial-up connection. 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... Meaning
> you can't disconnect for awhile (but for how long...). The
> problem is, how can I know when it's done? Is there a way to
> be notified when the data has truly been sent?

What OS are you using?

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.

> Is there something I'm missing, or is there a better way to do
> this?

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

-- 
Grant Edwards                   grante             Yow!  Remember, in 2039,
                                  at               MOUSSE & PASTA will
                               visi.com            be available ONLY by
                                                   prescription!!



More information about the Python-list mailing list