23 packages tagged with “tcpserver”
Simple framework for TCP clients and servers. Focused on performance and usability.
Net Standard 2.0 library for client-server data exchange based on tcp protocol.
Provides classes for fast and easy access to fast async tcp streaming, dns client, ssl client and server and ntp client and server implementations.
Provides a high performance async tcp client and server implementation
原生Socket实现用于TCP监听 TCPServer监听 UDP监听 HTTP 监听 1.2.0 增加Json/form-data数据直接转为实体对象给目标函数 路由标签使用方法时 方法所在类必须继承HttpRequest基类 1.2.5+ 增加对Task异步支持 更改 超过65535字节接收不了的问题 1.2.7 优化HTTP接收json时转换实体对象问题 1.2.8 解决formdata数据时解析字符串问题 1.2.10 优化异步数据接收 解决并发时数据接收不全的问题 1.2.11 增加无返回类型函数中通过this.Connection.send返回数据给客户端的功能 2.0.1 UDPServer中增加ClientSend方法 更改调用方式 2.0.2 允许使用 255.255.255.255 对某个端口进行广播 2.0.3 解决接收数据容易出现的已知问题 2.0.5 解决发送数据容易出现的已知问题 使用方式: ``` //TCP监听 var listener = TCPServer.Create(2020); listener.StartListen(s => { s.OnConnection = e => Console.WriteLine($@"OnConnection:{e.RemoteEndPoint}"); s.OnReceived = (e, data) => { Random random = new Random(); int randomNum = random.Next(0, 1000000); s.Send(Encoding.UTF8.GetBytes($@"ok>{s.RemoteEndPoint.ToString()}>>{randomNum}")); Console.WriteLine($@"OnData:{e.RemoteEndPoint},data:{Encoding.UTF8.GetString(data)}"); }; s.OnClosed = e => Console.WriteLine($@"OnClosed:{e.RemoteEndPoint}"); s.OnError = (conn, str, e) => Console.WriteLine($@"{conn.OnConnection} {str}:{e.Message}"); }); //UDP监听 var UDPlistener = UDPServer.Create(2020); UDPlistener.StartListen(s => { s.OnReceived = (e, data) => { Random random = new Random(); int randomNum = random.Next(0, 1000000); s.Send(s.RemoteEndPoint,Encoding.UTF8.GetBytes($@"ok>{s.RemoteEndPoint.ToString()}>>{randomNum}")); Console.WriteLine($@"UDP OnData:{e.RemoteEndPoint},data:{Encoding.UTF8.GetString(data)}"); }; s.OnError = (conn, str, e) => Console.WriteLine($@"{conn.RemoteEndPoint.ToString} {str}:{e.Message}"); }); //HTTP监听 var httplistener = HTTPServer.Create(2021); httplistener.SetPath(MethodEnum.GET, "/start"); httplistener.SetPath(MethodEnum.POST, "/start"); httplistener.StartListen(s => { //s.OnConnection = e => Console.WriteLine($@"OnConnection:{e.RemoteEndPoint}"); s.OnReceived = (e, Req) => { Random random = new Random(); int randomNum = random.Next(0, 1000000); s.Send($@"ok>{s.RemoteEndPoint.ToString()}>>{randomNum}"); Console.WriteLine($@"OnData:{e.RemoteEndPoint},data:{Req.Body}"); }; }); //HTTP监听路由写法: public class Workers : HTTPRequest { [Router("/start1", MethodEnum.GET)] public string Tests(string UserAccount, int Password) { Console.WriteLine("Body+>"+Content); return (new { code = 200, msg = "ok" }).ObjectToJson(); } [Router("/start1", MethodEnum.POST)] public object Tests2(string asd,List<int> aas) { foreach (var item in Headers) { Console.WriteLine(item.Key+":"+item.Value); } return new { code = 200, msg = "ok" }; } [Router("/start2", MethodEnum.POST)] public object Tests3(Testss testss) { foreach (var item in Headers) { Console.WriteLine(item.Key + ":" + item.Value); } return new { code = 200, msg = "ok" }; } } public class Testss { public string? UserAccount { get; set; } public string? Password { get; set; } } ```
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();
Components offering implementations of core Internet Communication Protocols such as HTTP, FTP, SMTP, IMAP, LDAP, REST, SOAP, WebSockets, and DNS through simple, easy-to-use, and intuitive APIs.
Smart.Ports是一个统一的通信端口类库,提供了一致的接口来操作不同类型的通信端口,包括串口(SerialPort)、TCP客户端(TcpClient)、TCP服务端(TcpServer)和UDP节点(Udp)。该类库使用工厂模式简化端口创建,并通过继承关系提供特定端口类型的扩展功能。 Smart.Ports is a unified communication port library that provides a consistent interface for operating different types of communication ports, including SerialPort, TcpClient, TcpServer, and Udp. The library uses the factory pattern to simplify port creation and provides extended functionality for specific port types through inheritance.
Support for EasyTcp to triggering specific functions with an attribute based on received data. See github for examples.
Ssl support for EasyTcp and EasyTcp.Actions
This is a simple TcpLibrary containing a TcpClient & TcpServer.
Asynchronous TCP C# library for server applications.
git https://github.com/yufb12/dataexcel_winform,A component similar to Microsoft Office Excel that can be used in C# WinForm projects, including CBScript, a scripting language with customizable APIs and keywords.The example code can be found at: http://www.dataexcel.cn/file/lib/DataExcelMain.rar
Description
Fast, Efficient, 100% Managed, Peer to Peer, Non Generic, Extensible TCP Client & Server with built in Serialization that can be used to transmit any type.
Lightweight TCP Server & Client for C#
TCP/IP Communication Framework (TCP/IP CF) is a library that wraps the .NET Socket class and defines several classes for developing communication applications that use TCP/IP. TCP/IP CF defines asynchronous operations and is designed to be used in small applications that communicate with a few devices or server applications that maintain communication with a large number of devices.
VNTG의 LEVEL2 시스템을 표준화된 방법으로 개발하기 위한 도구, 기능, 룰을 제공 하여 시스템 구축에 빠르게 적용 할 수 있는 패키지 입니다.
A simple way to make a TCP server and contains methods relating to conversions
High-performance, fully managed .NET networking library for TCP, UDP, and WebSocket communication. Features built-in peer-to-peer with NAT traversal, pluggable System.Text.Json serialization, SslStream TLS 1.2 encryption, GZip/Deflate compression, bandwidth throttling. Send any object across a unified, transport-agnostic API. Targets .NET Standard 2.1, .NET 8
High-performance, fully managed .NET networking library for TCP, UDP, and WebSocket communication. Features built-in peer-to-peer with NAT traversal, pluggable System.Text.Json serialization, SslStream TLS 1.2 encryption, GZip/Deflate compression, bandwidth throttling, and live WPF control sharing. Send any object across a unified, transport-agnostic API. Targets .NET Standard 2.1, .NET 8