0

if i am using tcp protocal in my appliction,then do i need to another retry mechanism in my application?

I want my msg are 100% received by my client,event it received duplicated msg , so client resend a ACK to server,in what case the server can not get the ack if i am using tcp long connection? and let's say the server/client code will not drop the ACK itself,and tcp connection will keep alive ,in this case ,do i need a retry mechanism in my server to make sure client get the msg? or is there any condition that the ack will loss? or will tcp loss packet?

paxi
  • 9

2 Answers2

1

TCP (only) cares that the data are delivered without loss, duplicates or reordering to the application. But it does not give the sender any feedback when the data have actually reached the target system. It also does not care if the application actually handles the data and it also does not provide reliably feedback if the application has actually read all data before it exit. Thus, if you need feedback that the application has actually processed and reacted to the data you've send then you need to add appropriate feedback to your application protocol.

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172
0

TCP is reliable protocol, it will not drop or reorder any data from the middle of the stream. (OOB data is an exception)

Example: When you send messages A and B (in this order) from a client to a server. TCP guarantee that the server application receives A from the TCP stream before B. TCP will abort the TCP connection before breaking that rule.

TCP do all necessary re-transmissions for you, to ensure that the output stream from the client is identical with the input stream of the server. And vice versa.

If your client and server applications won't drop/ignore already transmitted messages, then there should not be reason for re-sending messages at application level. Re-sending a message most probably causes duplicates.

SKi
  • 8,007
  • 2
  • 26
  • 57