Eugene To
Eugene To

Reputation: 1938

Does SocketChannel.write waits for TCP ACK?

We use java NIO on client side to communicate with a server. What happens in case of TCP retransmission:

will we hang on write operation till we get ACK or will we return immediately?

(I understant that IO is async and we are getting responses asynchronously, but what about ACKs)

Upvotes: 0

Views: 625

Answers (1)

user207421
user207421

Reputation: 310957

It does not wait for the ACK.

A TCP write is complete from the API's point of view when the data has been completely transferred into the sender's socket send buffer. What happens after that is completely asynchronous to, and undetectable by, the sending application, other than via close() with a positive LINGER timeout in blocking mode.

Upvotes: 4

Related Questions