在 LAN 外测试 UDP 代码时出现问题? [英] Problems testing UDP code outside of LAN?
问题描述
我在接下来的几天里学习udp.这个周末我将参加 72 小时的比赛之一,我希望在比赛结束时让我的 UDP 代码在线工作.在比赛期间我不会有任何互联网(所以没有打电话给某人并让他们测试).
I am learning udp in the next few days. This weekend I am going to be in one of those 72hour competition and I would like to have my UDP code work online by the end of it. During the competition I wont have any internet (so no calling someone and having them test).
我知道一些关于 UDP 的问题,比如数据包进入两次,而不进入几个帧(但我不知道我应该期望多长时间),推荐的字节大小(576)等.关于UDP编程我应该知道什么?
I know of some of the problems about UDP like packets coming in twice, not coming in for several frames (but I don't know how long in milliseconds I should expect), the recommended byte size (576) etc. What should i know about UDP programming?
但是从 LAN 迁移到 Internet 后,您会发生哪些事情?
But what are some of the things that happen to you after moving from LAN to internet?
注意:我将尽快运行一些代码并在线测试.希望我的最终代码看起来像,但我也可能会遗漏一些东西.
NOTE: I will be running some code ASAP and testing it online. Hopefully what my end code will look like but I may also miss a few things.
推荐答案
简短的回答是:在 LAN 上,您可能会注意到 UDP 的权衡(好的和坏的)很少,因为在 LAN 上很少有事情可以出错了.
The short answer is: on a LAN, you will probably notice very few of the tradeoffs (good and bad) of UDP, because on a LAN few things can go wrong.
您可能会丢失数据包.LAN 拥塞或本地系统限制是最可能的原因.
You could lose packets. LAN congestion or local system limitations are the most likely cause.
当你离开局域网并依赖路由器时,就会出现大部分UDP问题(碎片、重复数据包、延迟数据包、丢弃超过一定大小的数据包、没有返回错误消息).
When you leave the LAN, and depend on routers, then the majority of UDP problems will appear (fragmentation, duplicate packets, delayed packets, discarding of packets beyond a certain size, lack of error messages being returned).
换句话说,使 UDP 变得复杂的大部分原因是离开 LAN".
In other words, MOST of what makes UDP complicated is "leaving the LAN".
这篇关于在 LAN 外测试 UDP 代码时出现问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!