How to check TCP send buffer capacity for data delivery

I want to add delivery confirmation to my TCP interface. A non-blocking record may fill the send buffer, but the data may never appear if the connection is unsuccessful - while the record reported that the data was received (local socket).

If I added extra stacks to the stack, I could verify that every piece of data was received. I think ftp does this. But I cannot lend any code and would rather not run ack / resend, especially because TCP already does this.

I think this can be done if I can verify that the socket send buffer is empty after each record (). If there is no more data, everything should be delivered. I do not mind the delay in emptying the buffer.

Edit: I understand that the TCP / socket implementation is different by the system, but if there is a Berkeley or Linux solution, it is probably available to me.

Edit: To consider some suggestions, I would like to implement three layers of the TCP interface, where I do not know how to execute * 'd one.

  • Regular TCP without a delivery guarantee, for applications that like to live is dangerous.
  • * TCP, which checks receipt by the remote host, even if the packet was not delivered to the remote application. This reduces most of my connectivity risk (mobile client) and can be fully implemented on the client side. I think this can be implemented if I can verify that the outgoing socket buffer is empty.
  • Application ACKs and resubmission are implemented on top of TCP or UDP to verify endpoints.
0
source
2

acking - . :

  • send , , , TCP ACK . API .

  • , ACK, :

    • ​​( ) . , recv. , , recv.
    • ( ) . ACK, , . , .

:

  • TCP ACK s
  • ,

, ACK , , , . ACK : " ".

, . SIOCOUTQ, Linux. , Linux-onlye, , , .

+9

TCP . , , - , , - , TCP , .

. , , TCP-, - ack, . X, , X , OS TCP.

+2

All Articles