Search code examples
nio

AsynchronousSocketChannel.write ensures TCP ACK?


Question regarding AsynchronousSocketChannel.write method

public final <A> void write(ByteBuffer src,
             A attachment,
             CompletionHandler<Integer,? super A> handler)

Does this method guarantee ACK is received before the handler is fired?

Or it just ensures the ByteBuffer is delivered to network driver of local machine?


Solution

  • Neither. It ensures that the data has been transferred into the socket send buffer. From there it goes asynchronously to the NIC and from there to the network.