|
|
发表于 2007-10-21 03:53:00
|
显示全部楼层
Re:最近开始功网络模块了,udp还是tcp/ip?
啊,呵呵,这是国外论坛一位老兄的贴子
我觉得说得挺有道理,可以参考一下:
Ah, the good old TCP vs. UDP question :-)
What usually happens now is that someone says that you can use both, then someone else says that UDP is the only real option because it's faster than TCP and doesn't have latency issues - and after a lot of going back and forth, someone will mention that World of Warcraft uses TCP, and if it's good enough for WoW, it sure is good enough for them.
The thing is, just as with synchronous and asynchronous sockets, there are pros and cons. TCP is, in my opinion, easier to use for smaller projects because it's easier understand something that always delivers what you send, whereas UDP requires more programming for eg. ordered reliable delivery. However, if latency is a big thing in your type of games/applications, UDP may your only option.
Hope that helps at least a little bit - I'm sure you can find arguments for both TCP and UDP by googling "TCP vs UDP" or visiting the networking forums on gamedev.net.
|
|