SimpleTCPStandar 1.0.1

dotnet add package SimpleTCPStandar --version 1.0.1                
NuGet\Install-Package SimpleTCPStandar -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SimpleTCPStandar" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SimpleTCPStandar --version 1.0.1                
#r "nuget: SimpleTCPStandar, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SimpleTCPStandar as a Cake Addin
#addin nuget:?package=SimpleTCPStandar&version=1.0.1

// Install SimpleTCPStandar as a Cake Tool
#tool nuget:?package=SimpleTCPStandar&version=1.0.1                

SimpleTCP

Straightforward and incredibly useful .NET library to handle the repetitive tasks of spinning up and working with TCP sockets (client and server).

Original Proyect: https://github.com/BrandonPotter/SimpleTCP

Build Status

Want a TCP server that listens on port 8910 on all the IP addresses on the machine?

var server = new SimpleTcpServer().Start(8910);

Want a TCP client that connects to 127.0.0.1 on port 8910?

var client = new SimpleTcpClient().Connect("127.0.0.1", 8910);

Want TRY a TCP client that connects to 127.0.0.1 on port 8910 with 5 seconds timeout?

var client = new SimpleTcpClient().BeginConnect("127.0.0.1", 8910, 5);
if (client != null){ 
    Console.WriteLine("Connected!!");
    //Work with client
    }

Want to send "Hello world!" to the server and get the reply that it sends within 3 seconds?

var replyMsg = client.WriteLineAndGetReply("Hello world!", TimeSpan.FromSeconds(3));

Want to receive a message event on the server each time you see a newline \n (char 13), and echo back any messages that come in?

server.Delimiter = 0x13;
server.DelimiterDataReceived += (sender, msg) => {
                msg.ReplyLine("You said: " + msg.MessageString);
            };

Want to know how many clients are connected to the server?

int clientsConnected = server.ConnectedClientsCount;

Want to change the text encoding that the client and server uses when sending and receiving strings? (The default is ASCII/UTF8.)

server.StringEncoder = System.Text.ASCIIEncoding.ASCII;
client.StringEncoder = System.Text.ASCIIEncoding.ASCII;

Want to get the IP addresses that the server is listening on?

var listeningIps = server.GetListeningIPs();

Want to get only the IPv4 addresses the server is listening on?

var listeningV4Ips = server.GetListeningIPs().Where(ip => ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork);

Want to make your node.js friends stop saying things like "with node I can spin up a web server in only 4 lines of code"?

var server = new SimpleTcpServer().Start(80);
server.DataReceived += (sender, msg) => {
                msg.Reply("Content-Type: text/plain\n\nHello from my web server!"); 
                };

(But really, this library isn't ideal for web server-ing, so don't do that in prod.)

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on SimpleTCPStandar:

Repository Stars
chenxuuu/receiver-meow
🐱依靠Lua脚本实现功能的QQ机器人插件,基于 .Net 5。 对接OneBot协议。
Version Downloads Last updated
1.0.1 167,318 1/26/2018
1.0.0 1,008 1/25/2018

Add a simple BeginConnect.