Home>

I am a beginner.
I am confused by myself, so I think the question is incoherent.

I want to know

In socket communication (Java), I don't know how to send ACK (it is sent).
Simply tell me the ACK behavior after establishing a connection in Java socket communication.

Question (confused)

ACK is a ASCII code tableAccording to "0x06", I can't find a sample that explicitly sends 0x06 even if I check it on the net.
Hoshida's TCP memo According toso.connect,so.acceptandso.closeautomatically exchange SYN, ACK and FIN in the method Seems like.
However, when will the confirmation (ACK response) after sending return?

In fact, Socket class doesn't seem to have a receipt confirmation method.
Currently, I have three possibilities.

Assuming transmission and reception between client and server

  1. Socket method (.send ()) automatically attaches the acknowledgment (ACK) to the packet sent by the client when the server sends it
  2. Acknowledgment (ACK) to the packet sent by the client is explicitly attached with 0x06 on the data on the code when the server sends
  3. Acknowledgments (ACKs) for packets sent by clients are automatically returned periodically when the connection is in the established state.
As you can see,

is straying.

Teach us.

  • Answer # 1

    The ACK in the ASCII code table and the ACK for TCP communication are different. Not relevant

  • Answer # 2

    JavaSocketclass andread/writemethods (API) using sockets Rather than adding ACK flags, they are automatically added and managed by the OS TCP/IP stack. For example, when establishing a TCP connection, when the server side is waiting in theServerSocket # acceptmethod and the client side executes theSocket # connectmethod, those methods are used. Applications are unaware,

    SYN from client to server

    Server to client ACK + SYN

    ACK from client to server

    The flag is automatically sent and received like

    , and the connection is established. (3-way handshake) For sending and receiving data after this connection is established, the flag assignment is the same, and even if the client programwrite100 bytes of data, it is conscious about ACK ACK is sent and received within the scope of the OS under the application.

    If you are interested, install a packet capture software such as WireShark, create your own Java server/client program, check the packet when each method (API) is executed, and send and receive those flags. You can see that