Please give us 60 seconds to demonstrate the simplest, most concise, way of adding network functionality to any .Net application.

Using our network library you can send any custom object via TCP or UDP using IPv4 or IPv6 across multiple platforms in just a single line of code. Having said that there are also many more powerful methods and features available, please click here for a full feature breakdown.

To send:

//There are loads of ways of sending data
//The most simple, which we use here, just uses an 
//IP address (string) and port (integer)
//We are going to be sending a string object
NetworkComms.SendObject("Message", "127.0.0.1", 10000, "Networking in one line!");

To 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. 
//
//We will define what we want the handler to do inline by using
//a lambda expression
//http://msdn.microsoft.com/en-us/library/bb397687.aspx.
//We could also just point AppendGlobalIncomingPacketHandler 
//to a standard method (See other networkcomms.net examples)
//
//This handler will 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 on all
//available adaptors using a random port
//See also Connection.StartListening(ConnectionType.UDP, new IPEndPoint(IPAddress.Any, 0));
Connection.StartListening(ConnectionType.TCP, new IPEndPoint(IPAddress.Any, 0));

There you have it. Only three lines of code (ok, one is a little on the long side).

To see more tutorials please click here.

Some features at a glance