[.net] .NET network library?

Started by
15 comments, last by Spodi 16 years, 4 months ago
I'm currently in the process of looking into a network library for my C# game. My initial thought was using RakNet, but after I checked, there is no official RakNet .NET binding. I'm looking for a network library that supports both TCP and UDP. For UDP is must ensure that my data WILL arrive, and that it will arrive in order. It's pretty important that the data is ensured to be delivered. I did some googling, but there's a massive amount of libraries, so it's pretty difficult to narrow down which ones are good, and which ones provide a good API. Toolmaker

Advertisement
What's wrong with the .NET networking libraries?
Mike Popoloski | Journal | SlimDX
Ok, you want guaranteed, ordered delivery for UDP ... so why don't you just use TCP?
Quote:Original post by Toolmaker
I'm currently in the process of looking into a network library for my C# game. My initial thought was using RakNet, but after I checked, there is no official RakNet .NET binding.

I'm looking for a network library that supports both TCP and UDP. For UDP is must ensure that my data WILL arrive, and that it will arrive in order. It's pretty important that the data is ensured to be delivered.

I did some googling, but there's a massive amount of libraries, so it's pretty difficult to narrow down which ones are good, and which ones provide a good API.

Toolmaker

UDP with garaunteed, ordered arrival of packets is exactly TCP. TCP is built on top of UDP for the very reason to provide it with garaunteed, ordered arrival of packets.

Check out the System.Net and System.Net.Sockets namespaces. They are very featureful. They are not just a simple wrapper of WinSock.

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

I want UDP because it's connectionless. When the host is being dropped, it's much easier to maintain connections to the other clients. I'm making an RTS, so having connectionless connections is an added pro. UDP also has the added goodness that the opened tunnel stays open for a while in a NAT environment. Players don't have to open ports to play the game, except the player that hosts the initial connection.

However, during my research on RTS games in a networked environment, I ran into the "1500 archers over 28.8K" article on Gamasutra. One of the things they mentioned was UDP and garantueed delivery. However, it might be a good idea to drop the demand for delivery in order of sending. But, I want garantueed delivery.

Toolmaker

I ask again: What is wrong with the built in networking classes for .NET? They handle UDP and TCP. You can mix and match.
Mike Popoloski | Journal | SlimDX
[opinion]
If you care about guaranteeing order and delivery then there is no reason not to go with TCP. Anything you code for UDP that does that will be slower then just using TCP in the first place. That is not a slam against you, I don't know of anyone that could do it. If you really do care about that, then just use the "correct" protocol for what you are trying to do.

For the NAT issue, just look up "TCP" and "NAT punch through". It is pretty easy.

[/opinion]

Good luck with your project.
theTroll
The problem with TCP is that you cant have non-garanteed packets. Thats why there are libraries for garanteed UDP packets.

Look here:
http://code.google.com/p/lidgren-library-network/

I havent used this library yet, but it looks very good.
Quote:Original post by Toolmaker
I'm looking for a network library that supports both TCP and UDP. For UDP is must ensure that my data WILL arrive, and that it will arrive in order. It's pretty important that the data is ensured to be delivered.


If you read the OP, he wants guaranteed delivery. So why use UDP?

theTroll

Quote:Original post by Toolmaker
I want UDP because it's connectionless.


If you read the OP, he wants UDP. So why use TCP?

This topic is closed to new replies.

Advertisement