Net.TcpServer NuGet Package

A single-file event asynchronous(APM) tcp server and tcp client adapter for tcp debug assistant
// A echo server
TcpServer tcpServer = new TcpServer(IPAddress.Any, TcpServer.GetFreePort());
tcpServer.Start(_ =>
{
_.OnAccept = client =>
{
Console.WriteLine($"OnAccept: {client}");
};
_.OnReceive = (client, data) =>
{
Console.WriteLine($"OnReceive: {client} {Encoding.UTF8.GetString(data)}");
client.Send(data, endPoint => Console.WriteLine($"Send: {endPoint} complated"));
};
_.OnError = (client, ex) =>
{
Console.WriteLine($"OnError: {client} {ex.Message}");
};
_.OnClose = (client, isCloseByClient) =>
{
Console.WriteLine($"OnClose: {client} {(isCloseByClient ? "by client" : "by server")}");
};
});
Console.ReadKey();
tcpServer.Stop();.




Got any Net.TcpServer Question?





Info

Version: 1.0.3
Author(s): Net.TcpServer
Last Update: Wednesday, December 29, 2021
.NET Fiddle: Create the first Fiddle
Project Url: https://github.com/IOL0ol1/Net.TcpServer
NuGet Url: https://www.nuget.org/packages/Net.TcpServer


Install
Install-Package Net.TcpServer
dotnet add package Net.TcpServer
paket add Net.TcpServer
Net.TcpServer Download (Unzip the "nupkg" after downloading)



Tags



STATS

must-have-score

avg-downloads-per-day

0

days-since-last-release

1058