initialize TCP variables:
sequence numbers
buffers,flow control info
Client: connection initiator
Socket clientSocket = new Socket("hostname","portnumber");
Server: contacted by client
Socket connectionSocket = welcomeScoket.accept();
Three-Way handshake:
step1: Client sends TCP SYN segment to server
specifies initial seqnum = x
no data
step2: server receives SYN replies with SYN/ACK segment
server allocates buffers
specifies server initial seq =y
acknowledgement = x+1
step3: client receives SYN/ACK replies with ACK segment .which my contain data
acknowledgement = y+1
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/susser43/article/details/46728419