.NET网络库
我一直在寻找一个像样的 C# 网络库。 它将与 XNA 3.1 和 .NET Framework 3.5 一起使用。 多人游戏风格将是服务器和客户端。 目前,我一直在研究 Lidgren 图书馆网络,但它似乎已经过时了。
任何人都对好的网络图书馆有一些好的建议。它应该能够轻松地同时处理 30 多个客户端连接。
I've been looking for a decent network library for C#.
It is going to be used with XNA 3.1, and .NET Framework 3.5.
The multi-player style is going to be Server and Client.
Currently I have been looking into Lidgren Library Network, but it seems outdated.
Anyone got some good suggestions for a good network library. It should be able to handle easily 30+ client connections at a time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
尽管没有什么可以阻止您自己编写所有低级网络代码,但使用库绝对是节省大量时间和压力的好方法,然后您可以更好地将这些时间用于改进自己的应用程序。
此处尚未提及的库是 networkComms.net。它具有大量复杂的功能(例如序列化、压缩和加密),但考虑到您具体提到的连接数量,它能够以 1Gbps+ 的传输速率处理 1000 多个连接。有一篇简单的文章介绍如何创建快速客户端服务器应用程序< /a> 但简而言之,您可以按如下方式发送和接收。
发送:
接收:
免责声明:我是这个库的开发人员之一。
Although there is nothing stopping you from writing all of the low level networking code yourself, using a library is definitely a great way to save loads of time and stress, time which you can then better spend improving your own application.
A library not already mentioned here is networkComms.net. It has a plethora of sophisticated features (such as serialisation, compression and encryption) but given you mention number of connections specifically it is capable of handling 1000+ connections with transfer rates of 1Gbps+. There is a simple article on how to create a quick client server application but in brief you could send and receive as follows.
To send:
To receive:
Disclaimer: I'm one of the developers for this library.
您的链接确实已过时;但如果您阅读该页面,它会将您定向到较新的版本:http:// code.google.com/p/lidgren-network-gen3/
Your link is indeed outdated; but if you read the page it will direct you to the newer version: http://code.google.com/p/lidgren-network-gen3/
您似乎找错地方了。您似乎没有查看 .NET Framework 本身。
使用 WCF 怎么样?使用
TcpListener
怎么样?你需要什么而这些却没有提供?
You seem to be looking in the wrong place. You don't seem to have looked in the .NET Framework itself.
What about using WCF? What about using
TcpListener
?What do you need that these do not provide?
WCF 是一种可能性,尽管对于这种情况来说它可能有点重量级。 .NET 套接字(OTOH)通常太底层;它们不是一个容易插入的“组件”(在正确使用 Socket 类之前必须很好地学习网络和多线程)。
我编写了一个库 Nito.Async.Sockets,它是 Nito.Async 的一部分。它消除了套接字编程中的多线程注意事项,并且还包括处理 的更高级别抽象消息框架和keepalives 。
WCF is one possibility, though it may be a bit heavyweight for this scenario. .NET Sockets, OTOH, are often too low-level; they're not an easy "component" to just plug in (both networking and multithreading must be learned well before the Socket class can be used correctly).
I wrote a library, Nito.Async.Sockets, which is part of Nito.Async. It removes multithreading considerations from socket programming, and also includes a higher-level abstraction that handles message framing and keepalives.
利格伦怎么过时了?它仍然是 .NET 领域中唯一的主要参与者。用于游戏网络。
How is lidgren outdated? It is still the only major player in the .NET space for gaming networking.
您是否尝试过 System.Net 中的内置 .Net 库?您根本不需要使用外部库。 这是简单线程 TCP 服务器的示例可能还想看看 UDP。如果你用谷歌搜索一下,就会有很多教程。
尝试查看
System.Net.Sockets
MSDN 页面了解更多信息。Have you tried the inbuilt .Net libraries found in
System.Net
? It is very unlikely that you need to use an external library at all. Here's an example of simple threaded TCP server and you may want to look at UDP as well. There are loads of tutorials if you just google around a bit.Try looking at the
System.Net.Sockets
MSDN page for more information.此时,我想将我的 库 放入此线程中。 NuGet 也可用。
At this point I would like to throw my library into this thread. NuGet available as well.