简体   繁体   English

在异步中,我如何将数据发送到所有或某些客户端?

[英]In asyncore how can i send data to all or some of the clients?

I'm building a little MMORPG and im trying to use asyncore rather then threading. 我正在构建一些MMORPG,并尝试使用asyncore而不是线程。

1) How would i send data to certain clients, because in threading a saved each clients socket and current in a dictionary a with its unique id as a key. 1)我将如何发送数据到某些客户端,因为在线程化保存的每个客户端套接字和当前字典中的a以其唯一ID作为键。 So how could i subjective send data to all the clients. 因此,我如何主观地将数据发送给所有客户端。

Thankyou, please say if i didnt give enough information 谢谢,如果我没有提供足够的信息,请说

I find it great that you want to move to asynchronous programming instead of threading, since it is so much reliable and easier to debug. 我发现您希望转向异步编程而不是线程化非常好,因为它非常可靠且易于调试。

However, asyncore is a bad library to do so. 但是, asyncore是一个不好的库。 I don't advise you use it at all, since it requires a significant rewrite to do simple things like read standard io. 我不建议您使用它,因为它需要进行大量重写才能完成读取标准io之类的简单操作。

I suggest you move to twisted - it is a great asynchronous framework, well tested and developed, with good api documentation and good community support. 我建议您转弯 -它是一个出色的异步框架,经过了良好的测试和开发,并具有良好的api文档和良好的社区支持。

Regardless of your decision on which library to use, I find this series of blog posts by Dave Peticolas to be a great source of beginner information on asynchronous programming. 无论您决定使用哪个库,我都会发现Dave Peticolas撰写的这一系列博客文章是有关异步编程的初学者信息的重要来源。 Please read it. 请阅读。

There are some games under development using twisted. 有一些正在开发中的使用扭曲游戏。 One example is Minions of Mirth - I never played it but it seems cool. 一个例子是《小黄人》 -我从没玩过,但看起来很酷。

There's also divmod's imaginary - it's a simulationist's take on the realm of role playing, interactive fiction, and multiplayer dungeons. 还有divmod的假想 -这是模拟 主义者 在角色扮演,互动小说和多人地下城领域中的角色。 It incorporates gameplay features from each area while attempting to provide a richer environment than is generally available from existing systems. 它融合了每个区域的游戏功能,同时试图提供比现有系统通常更丰富的环境。

Hope I helped. 希望我能帮上忙。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM