简体   繁体   中英

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM