EasyTcp 2.0.2
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.
See the version list below for details.
Install-Package EasyTcp -Version 2.0.2
dotnet add package EasyTcp --version 2.0.2
<PackageReference Include="EasyTcp" Version="2.0.2" />
paket add EasyTcp --version 2.0.2
The whole documentation is to big for nuget, please see the wiki on my github.
Getting started
Add 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.
Add the namespace "EasyTcp.Client" for the EasyTcpClient class.
Add the namespace "EasyTcp.Server" for the EasyTcpServer class;
Example of a simple server wich 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 wich 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
Add 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.
Add the namespace "EasyTcp.Client" for the EasyTcpClient class.
Add the namespace "EasyTcp.Server" for the EasyTcpServer class;
Example of a simple server wich 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 wich 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
- Changed data tag to ushort.
- Changed MaxDataSize to ushort.
Dependencies
-
.NETStandard 2.0
- No dependencies.
Used By
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 | 176 | 1/1/2021 |
3.7.8 | 440 | 10/1/2020 |
3.7.7 | 102 | 9/24/2020 |
3.6.7 | 98 | 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 | 171 | 6/25/2020 |
3.1.0 | 228 | 5/30/2020 |
3.0.0 | 236 | 5/20/2020 |
3.0.0-rc | 128 | 4/30/2020 |
2.0.4.2 | 655 | 9/28/2019 |
2.0.4.1 | 489 | 5/21/2019 |
2.0.4 | 319 | 4/11/2019 |
2.0.3 | 292 | 3/5/2019 |
2.0.2 | 274 | 2/18/2019 |
2.0.1 | 258 | 2/16/2019 |
2.0.0 | 289 | 2/15/2019 |