数据包交换过程中剪线的代码 [英] Code to wire cut during packet switching

查看:64
本文介绍了数据包交换过程中剪线的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将数据包从DSLAM发送到调制解调器.数据包是UDP.如果传输突然中断,我们应该知道天气是由于调制解调器关闭或电线中断造成的.这是我们在IPTV中面临的问题.

I am sending packet from DSLAM to modem.Packets are UDP.If in case transmission gets over suddenly we should know weather it is because of modem being off or wire cut.It is a problem we face in IPTV.

推荐答案

您无法确定确定为什么断开连接的任何方法.您只能确定它确实确实掉线了.
There''s no earthly way you can determine why the connection dropped. You can only determine that it did in fact drop.


UDP没有内置的连接状态,当切换到TCP不可行时,这是另外两种选择:

1)您可能想要向应用程序添加连通性测试.例如,定期测试是否有可用的服务(在Internet上).

2)如果没有要使用的连接状态,请通过在自己的应用程序中实现合理的快速心跳来添加一个连接状态.如果对等方A要了解对等方B的状态/可用性,则它必须定期接收来自B的消息"(并且thefor知道对等方B还活着)-或-在没有常规流量可搭载时心跳,那么对等方之一必须在合理的时间间隔内发起(附加)心跳.例如,IRC服务器每隔几分钟使用常规ping/pong消息来查找其聊天客户端的连接状态.
UDP does not have a built-in connectivity status, when switching to TCP is not feasible then here are two other alternatives:

1) You might want to add a connectivity test to your application. For example test in regular interval if a service (on the internet) is still available.

2) If you do not have a kind of connectivity status to use, then add one by implementing a reasonable fast heartbeat in your own application. If peer A wants to know about the status/availability of peer B, it either has to receive a "message" from B in regular intervals (and therfor knows that peer B is alive) -or- when there is no regular traffic to piggyback the heartbeat then one of the peers has to initiate (additional) heartbeats in reasonable intervals. For example an IRC server uses regular ping/pong messages every few minutes to find out about the connection status of its chat clients.


这篇关于数据包交换过程中剪线的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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