Re: Networking Question
From: Bernd Petrovitsch
Date: Tue Jun 21 2022 - 03:47:21 EST
Hi all!
On 21/06/2022 02:29, Ryan P. Nicholl wrote:
I've been unable to find any Linux API for asynchronously waiting for the TCP send buffer to drain.
The problem I have, in a nutshell, is noted in this part of the documentation:
If fildes refers to a socket, close() shall cause the socket to
be destroyed. If the socket is in connection-mode, and the
That's not really a Linux kernel question as such (because that should
work that way on all TCP connections anywhere) but the shutdown()
syscall is probably what you need:
- your side shuts down the sending part of the socket.
- the other side reads data and gets eventually EOF
- the other side call shutdown() for it's sending side when it's done.
- your side gets EOF.
And then your side knows that no data is in flight.
- finally, you clean up with close(). You can shutdown() the receiving
side too but doesn't change anything.
[ deleted SO_LINGER stuff - that's for something completelly different ... ]
Kind regards,
Bernd
--
Bernd Petrovitsch Email : bernd@xxxxxxxxxxxxxxxxxxx
There is NO CLOUD, just other people's computers. - FSFE
LUGA : http://www.luga.at