EasyTcp 2.0.4

A high performance/async tcp server and client. (SocketBased) (Supports IPv6 & IPv4)
Simple and easy to use(but also advanced) and has a good documentation.

There is a newer version of this package available.
See the version list below for details.
Install-Package EasyTcp -Version 2.0.4
dotnet add package EasyTcp --version 2.0.4
<PackageReference Include="EasyTcp" Version="2.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasyTcp --version 2.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

The whole documentation is to big for nuget, please see the wiki on my github.

Getting started

Use the namespace "EasyTcp" for the Message and Encryption class. The Message class is used by the event handler DataReceived. The Encryption class is used when working with encryption.

Use the namespace "EasyTcp.Client" for the EasyTcpClient class.

Use the namespace "EasyTcp.Server" for the EasyTcpServer class;

Example of a simple server which print the length of the received data:

Example of a simple server which print the length of the received data:

using System;
using EasyTcp;
using EasyTcp.Server;

namespace EasyTcpExampleServer
{
    class Program
    {
        static void Main(string[] args)
        {
            EasyTcpServer server = new EasyTcpServer();
            /* Start a server:
             * IP: IPAddress.Any(IPv4)
             * Port: 999
             * MaxConnections: 1000
             */
            server.Start(System.Net.IPAddress.Any,999,1000);
            server.DataReceived += DataReceived;//Set event for DataReceived.

            System.Threading.Tasks.Task.Delay(-1).Wait();//Don't exit the console.
        }

        private static void DataReceived(object sender, Message e)
        {
            Console.WriteLine($"Received: {e.Data.Length} bytes");
        }
    }
}

Example of a simple client which send to the server: "Hey server"

using System;
using EasyTcp;
using EasyTcp.Client;

namespace EasyTcpExampleClient
{
    class Program
    {
        static void Main(string[] args)
        {
            EasyTcpClient client = new EasyTcpClient();
            /*Connect to server:
             * IP: 127.0.0.1(IPv4)
             * Port: 999
             * Timeout: 1 second
             */
            bool connected = client.Connect("127.0.0.1",999,TimeSpan.FromSeconds(1));

            if(!connected)
            {
                Console.WriteLine("Could not connect to server");
                Console.ReadKey();
                return;
            }

            client.Send("Hey server");    
            System.Threading.Tasks.Task.Delay(-1).Wait();//Don't exit the console.    
        }
    }
}

More advanced (Click)

The whole documentation is to big for nuget, please see the wiki on my github.

Getting started

Use the namespace "EasyTcp" for the Message and Encryption class. The Message class is used by the event handler DataReceived. The Encryption class is used when working with encryption.

Use the namespace "EasyTcp.Client" for the EasyTcpClient class.

Use the namespace "EasyTcp.Server" for the EasyTcpServer class;

Example of a simple server which print the length of the received data:

Example of a simple server which print the length of the received data:

using System;
using EasyTcp;
using EasyTcp.Server;

namespace EasyTcpExampleServer
{
    class Program
    {
        static void Main(string[] args)
        {
            EasyTcpServer server = new EasyTcpServer();
            /* Start a server:
             * IP: IPAddress.Any(IPv4)
             * Port: 999
             * MaxConnections: 1000
             */
            server.Start(System.Net.IPAddress.Any,999,1000);
            server.DataReceived += DataReceived;//Set event for DataReceived.

            System.Threading.Tasks.Task.Delay(-1).Wait();//Don't exit the console.
        }

        private static void DataReceived(object sender, Message e)
        {
            Console.WriteLine($"Received: {e.Data.Length} bytes");
        }
    }
}

Example of a simple client which send to the server: "Hey server"

using System;
using EasyTcp;
using EasyTcp.Client;

namespace EasyTcpExampleClient
{
    class Program
    {
        static void Main(string[] args)
        {
            EasyTcpClient client = new EasyTcpClient();
            /*Connect to server:
             * IP: 127.0.0.1(IPv4)
             * Port: 999
             * Timeout: 1 second
             */
            bool connected = client.Connect("127.0.0.1",999,TimeSpan.FromSeconds(1));

            if(!connected)
            {
                Console.WriteLine("Could not connect to server");
                Console.ReadKey();
                return;
            }

            client.Send("Hey server");    
            System.Threading.Tasks.Task.Delay(-1).Wait();//Don't exit the console.    
        }
    }
}

More advanced (Click)

Release Notes

- Updated encryption class
 - Added GetKey();

  • .NETStandard 2.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on EasyTcp:

Package Downloads
EasyTcp.Encryption
Ssl support for EasyTcp and EasyTcp.Actions
EasyTcp.Actions
Support for EasyTcp to triggering specific functions based on received data. See github for examples.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
4.0.0-beta 178 1/1/2021
3.7.8 457 10/1/2020
3.7.7 106 9/24/2020
3.6.7 102 9/21/2020
3.6.5 326 8/13/2020
3.6.4 178 8/13/2020
3.6.3 279 7/16/2020
3.6.0 250 7/4/2020
3.5.0 212 6/30/2020
3.4.0 168 6/29/2020
3.3.1 179 6/26/2020
3.3.0 192 6/26/2020
3.2.0 172 6/25/2020
3.1.0 228 5/30/2020
3.0.0 237 5/20/2020
3.0.0-rc 132 4/30/2020
2.0.4.2 655 9/28/2019
2.0.4.1 493 5/21/2019
2.0.4 323 4/11/2019
2.0.3 296 3/5/2019
2.0.2 278 2/18/2019
2.0.1 258 2/16/2019
2.0.0 294 2/15/2019
Show less