游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1940|回复: 4

最近开始功网络模块了,udp还是tcp/ip?

[复制链接]

119

主题

1367

帖子

1393

积分

金牌会员

Rank: 6Rank: 6

积分
1393
发表于 2007-10-20 23:18:00 | 显示全部楼层 |阅读模式
客户端也做了不少东西了,主要是角色和室外场景管理方面的,要做完善是没有止境的,所以想先放放,攻克网络模块

我的连接投递这一块打算用完成端口

但是套节字这一块到底是用udp还是tcp呢?

就可靠而言肯定是tcp,效率而言当然是udp

那么在真实的游戏服务器架构中,这两者如何取舍?

或者说分别在那些情况下去使用?这方面自己的经验不足

另外听说ACE对这些都做了封装,苦于资料较少,短期内不甚了解

还请有经验的朋友多多赐教!!!

59

主题

984

帖子

1200

积分

金牌会员

Rank: 6Rank: 6

积分
1200
发表于 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.

54

主题

2916

帖子

3765

积分

论坛元老

Rank: 8Rank: 8

积分
3765
QQ
发表于 2007-10-21 08:16:00 | 显示全部楼层

Re:最近开始功网络模块了,udp还是tcp/ip?

同上,我也支持UDP!

149

主题

4981

帖子

5033

积分

论坛元老

Rank: 8Rank: 8

积分
5033
QQ
发表于 2007-10-22 10:56:00 | 显示全部楼层

Re:最近开始功网络模块了,udp还是tcp/ip?

一开始先用TCP吧,等测试了才知道瓶颈在哪。
特别是如果用了UDP最后却发现自己把TCP做的事情又做了一遍那就没意思了……

119

主题

1367

帖子

1393

积分

金牌会员

Rank: 6Rank: 6

积分
1393
 楼主| 发表于 2007-10-22 13:52:00 | 显示全部楼层

Re:最近开始功网络模块了,udp还是tcp/ip?

恩,的确
udp感觉比tcp难度要大很多啊,包无序,丢包处理。好多烦心事
我还是先用tcp好了。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-12-16 04:43

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表