I am trying to implement one tcp stack. Following steps I have followed:
TCP open:
a. Client sent 'SYN' with a initial sequence no "C" and Ack no as "0" to server.
b. Server responded with SYN + ACK with seq no "S" and ack no "C+1".
c. Client send ACK+PSH with sequence no "C+1" and ack no "S+1".
TCP send and recv:
a. Client will send the request for data with ACK flag and the data with seq no "C+1" and ack no "S+1"
b. The sender will send gragment with seq no "S+1+data" in segment and receiver will send ACK with ack no "S+1+data" will continue till the FIN or RST is transmitted.
In my case during data transmission I am not getting few packets but I can see them on wireshark.
Is there any mechanism to check for out of order data and packet loss using sequence number and ack number and to get the packet back