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