.NET Network Library

I was looking for a decent network library for C #. It will be used with XNA 3.1 and the .NET Framework 3.5. The multi-user style will be server and client. I am currently browsing the Lidgren Library Network , but seems to be out of date.

Everyone has good suggestions for a good online library. It should be able to simultaneously handle 30+ client connections.

+4
source share
6 answers

Your link is really out of date; but if you read the page, it will redirect you to the new version: http://code.google.com/p/lidgren-network-gen3/

+3
source

Although nothing prevents you from writing all the low-level network code yourself, using the library is a great way to save a ton of time and stress, time that you can better spend on improving your own application.

A library not mentioned here is networkComms.net . It has many complex features (such as serialization, compression, and encryption), but given the number of connections mentioned, it is capable of handling 1000+ connections at a transmission rate of 1 Gbit / s +. There is a simple article on how to create a fast client-side server application , but in short you can send and receive the following.

Submit:

//This is the simplest way to send with more advanced options also available //Parameters are message type, IP address, port and the object to send NetworkComms.SendObject("Message", "127.0.0.1", 10000, "Networking in one line!") 

Receive:

 //We need to define what happens when packets are received. //To do this we add an incoming packet handler for //a 'Message' packet type. // //This handler will automatically convert the incoming raw bytes into a string //(this is what the <string> bit does) and then write that string to the //local console window. NetworkComms.AppendGlobalIncomingPacketHandler<string>("Message", (packetHeader, connection, incomingString) => { Console.WriteLine("\n ... Incoming message from " + connection.ToString() + " saying '" + incomingString + "'."); }); //Start listening for incoming 'TCP' connections. The true //parameter means try to use the default port and if that //fails just choose a random port. //See also UDPConnection.StartListening() TCPConnection.StartListening(true); 

Disclaimer: I am one of the developers of this library.

+10
source

WCF is one of the features, although it can be a bit overwhelming for this scenario .. NET Sockets, OTOH, often too low-level; they are not an easy “component” to just plug in (both network and multithreaded reads should be learned long before the Socket class can be used correctly).

I wrote the Nito.Async.Sockets library, which is part of Nito.Async . It removes multithreaded considerations from socket programming, and also includes a higher level abstraction that handles message framing and keepalives .

+2
source

How does lidgren become obsolete? He is still the only major player in .NET for gaming networks .

+2
source

You seem to be looking in the wrong place. You didn't seem to be looking in the .NET Framework itself.

How about using WCF? How about using TcpListener ?

What do you need them to not provide?

+1
source

Have you tried the built-in .Net libraries found in System.Net ? It is very unlikely that you need to use an external library at all. Here is an example of a simple streaming TCP server, and you can also look at UDP. There are many tutorials if you just advertise a little.

See the System.Net.Sockets MSDN page for more information.

+1
source

Source: https://habr.com/ru/post/1310601/


All Articles