如果我的应用程序使用 tcp 协议?那么我的应用程序中是否需要重试机制? [英] if my application is using tcp protocal? then do i need a retry mechanism in my Application?

查看:22
本文介绍了如果我的应用程序使用 tcp 协议?那么我的应用程序中是否需要重试机制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在我的应用程序中使用 tcp 协议,那么我是否需要在我的应用程序中使用另一种重试机制?

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

我希望我的 msg 被我的客户端 100% 接收,如果它收到重复的 msg ,那么客户端重新发送一个 ACK​​ 到服务器,如果我使用 tcp 长连接,服务器在什么情况下无法收到 ack?假设服务器/客户端代码不会丢弃 ACK 本身,并且 tcp 连接将保持活动状态,在这种情况下,我是否需要在服务器中使用重试机制来确保客户端收到 msg?或者是否有任何条件会丢失ack?还是tcp会丢包?

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?

推荐答案

TCP(仅)关心将数据传送到应用程序时不会丢失、重复或重新排序.但是当数据真正到达目标系统时,它不会给发送者任何反馈.它也不关心应用程序是否实际处理数据,并且如果应用程序在退出之前实际读取了所有数据,它也不会提供可靠的反馈.因此,如果您需要应用程序实际处理并响应您发送的数据的反馈,那么您需要向应用程序协议添加适当的反馈.

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.

这篇关于如果我的应用程序使用 tcp 协议?那么我的应用程序中是否需要重试机制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆