All Projects → Job79 → Easytcp

Job79 / Easytcp

Licence: mit
Simple framework for TCP clients and servers. Focused on performance and usability.

Projects that are alternatives of or similar to Easytcp

Socketify
Raw TCP and UDP Sockets API on Desktop Browsers
Stars: ✭ 67 (+11.67%)
Mutual labels:  tcp, sockets, tcp-server, tcp-client
ctsTraffic
ctsTraffic is a highly scalable client/server networking tool giving detailed performance and reliability analytics
Stars: ✭ 125 (+108.33%)
Mutual labels:  tcp, sockets, tcp-server, tcp-client
Simpletcp
Simple wrapper for TCP client and server in C# with SSL support
Stars: ✭ 99 (+65%)
Mutual labels:  tcp, tcp-server, tcp-client, ssl
SuperSimpleTcp
Simple wrapper for TCP client and server in C# with SSL support
Stars: ✭ 263 (+338.33%)
Mutual labels:  ssl, tcp, tcp-server, tcp-client
Packetsender
Network utility for sending / receiving TCP, UDP, SSL
Stars: ✭ 1,349 (+2148.33%)
Mutual labels:  tcp, tcp-server, tcp-client, ssl
Bizsocket
异步socket,对一些业务场景做了支持
Stars: ✭ 469 (+681.67%)
Mutual labels:  tcp, tcp-server, sockets, tcp-client
React Native Tcp Socket
React Native TCP socket API for Android, iOS & macOS with client SSL/TLS support
Stars: ✭ 112 (+86.67%)
Mutual labels:  tcp, tcp-server, tcp-client, ssl
tcp-net
Build tcp applications in a stable and elegant way
Stars: ✭ 42 (-30%)
Mutual labels:  tcp, tcp-server, tcp-client
network
exomia/network is a wrapper library around System.Socket for easy and fast TCP/UDP client & server communication.
Stars: ✭ 18 (-70%)
Mutual labels:  tcp, tcp-server, tcp-client
Bigq
Messaging platform in C# for TCP and Websockets, with or without SSL
Stars: ✭ 18 (-70%)
Mutual labels:  tcp, sockets, ssl
tcp server client
A thin and simple C++ TCP client server
Stars: ✭ 124 (+106.67%)
Mutual labels:  tcp, tcp-server, tcp-client
Simpleunitytcp
🖧 Simple Unity Project to show how TCP communication are builded in C# without multi-threading or Unity network (Unet) involved.
Stars: ✭ 22 (-63.33%)
Mutual labels:  tcp, tcp-server, tcp-client
EasyFileTransfer
An easy way to transfer file with any size on network with tcp protocol.
Stars: ✭ 30 (-50%)
Mutual labels:  tcp, tcp-server, tcp-client
AsyncTcpClient
An asynchronous variant of TcpClient and TcpListener for .NET Standard.
Stars: ✭ 125 (+108.33%)
Mutual labels:  tcp, tcp-server, tcp-client
Netcoreserver
Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
Stars: ✭ 799 (+1231.67%)
Mutual labels:  tcp-server, tcp-client, ssl
QTcpSocket
A simple Qt client-server TCP architecture to transfer data between peers
Stars: ✭ 62 (+3.33%)
Mutual labels:  tcp, tcp-server, tcp-client
Tacopie
C++ TCP Library - NO LONGER MAINTAINED
Stars: ✭ 359 (+498.33%)
Mutual labels:  tcp, tcp-server, tcp-client
Message Io
Event-driven message library for building network applications easy and fast.
Stars: ✭ 321 (+435%)
Mutual labels:  tcp, tcp-server, sockets
Tinytcpserver
A small tcp server working under Mono or .NET (4.0) and provides hooks for handling data exchange with clients (works under mono and .net). Behaviour/protocol/reaction could be specified via custom C# script.
Stars: ✭ 14 (-76.67%)
Mutual labels:  tcp, tcp-server, tcp-client
Oksocket
An blocking socket client for Android applications.
Stars: ✭ 2,359 (+3831.67%)
Mutual labels:  tcp, tcp-server, tcp-client


Nuget Nuget GitHub stars
Easy and simple library for TCP clients and servers. Focused on performance and usability.


EasyTcp?

EasyTcp is a library that makes creating tcp servers and clients simple without giving up performance*
It has built-in serialisation, compression, different types of framing and an (optional) async interface.

* ~400.000 round trips/second, tested on local machine(linux, ryzen 7) with clients and server running under the same process. See EasyTcp.Examples/SpeedTest/ThroughputTest.cs

Example

The folowing code will create a tcp server that writes all received data to the terminal.
Then it will create a client that connects with the server followed by the client sending: "Hello Server"

using var server = new EasyTcpServer().Start(8080);
server.OnDataReceive += (sender, message) => Console.WriteLine(message);

using var client = new EasyTcpClient();
if(!client.Connect("127.0.0.1", 8080)) return; // Abort if connection attempt failed
client.Send("Hello server");
Console.ReadLine();

// Output terminal: "Hello server"

See also EasyTcp/Examples

Different packages

EasyTcp has different packages, this to keep the project maintainable and the dependencies small (in disk size). Every package has his own goal and all packages are compatible with eachother.

EasyTcp

EasyTcp is the package that contains all the basic functions for both servers and clients.
It includes multiple types of framing, disconnect detection, compression, serialisation, event handlers, streaming support and much more.

EasyTcp.Actions

EasyTcp.Actions adds support to EasyTcp for triggering functions based on received data for both client and servers.
It does this without giving up (noticeable) performance, and makes creating big servers/clients easy/maintainable.
Here is a very basic code example demonstrating EasyTcp.Actions:

static void Main(string[] args)
{
     using var server = new EasyTcpActionServer().Start(PORT); // Server automatically detects all action methods within the current assembly
     server.OnUnknownAction += (s, actionMessage) => Console.WriteLine("Unknown action received");
     Console.ReadLine();
}

[EasyTcpAction("ECHO")] // Trigger function when "ECHO" action is received
public void EchoAction(Message message)
{
    message.Client.Send(message);
}

[EasyTcpAction("BROADCAST")]
public void BroadCastAction(object sender, Message message)
{
    var server = (EasyTcpServer) sender; // Retrieve server
    server.SendAll(message);
}
using var client = new EasyTcpClient();
if(!client.Connect("127.0.0.1", PORT)) return; 
client.SendAction("ECHO","Hello me"); // Trigger the ECHO action server side
client.SendAction("BROADCAST","Hello everyone"); // Trigger the BROADCAST action server side
Console.ReadLine();

EasyTcp.Encryption

EasyTcp.Encryption adds tls/ssl and custom encryption support to EasyTcp.
Here's another basic code example:

using var certificate = new X509Certificate2("certificate.pfx", "password"); // Load ssl certificate
using var server = new EasyTcpServer().UseSsl(certificate).Start(PORT); // Use ssl for all incoming / outgoing messages

server.OnDataReceive += (sender, message) => Console.WriteLine(message); // Message is automatically decrypted
using var client = new EasyTcpClient().UseSsl("localhost",  acceptInvalidCertificates: true); // "localhost" = server domain
if(!client.Connect("127.0.0.1", PORT)) return;
client.Send("Hello ssl server!"); // All data is automatically encrypted



using var encrypter = new EasyEncrypt("Password", "Salt531351235"); // Encryption library used by EasyTcp, default = AES encryption. 
using var server = new EasyTcpServer().UseEncryption(encrypter).Start(PORT);  // Use encryption for all incoming / outgoing messages

server.OnDataReceive += (sender, message) => Console.WriteLine(message); // Message is automatically decrypted
using var encrypter = new EasyEncrypt("Password", "Salt531351235");
using var client = new EasyTcpClient().UseEncryption(encrypter); 
if(!client.Connect("127.0.0.1", PORT)) return;
client.Send("Hello encrypted server!"); // All data is automatically encrypted

EasyTcp.Logging

EasyTcp.Logging adds support for logging of incoming/outgoing messages/connections and internal errors.

using var server = new EasyTcpServer().UseServerLogging(Console.WriteLine).Start(Port);

using var client = new EasyTcpClient().UseClientLogging(Console.WriteLine);
if(!client.Connect("127.0.0.1", Port)) return;
client.Send("Hello server!");
Console.ReadLine();      

Contribution / Help / Questions / Feedback

Create an issue or send an email to [email protected]

Thanks to

List with people who directly / indirectly contributed to this project.
@AndreiBlizorukov Fixed .gitignore
@Kermalis, @AbnirHencazs, @bnaambo Reporting important issues
@Awware, @jchristn Inspiration

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].