dmuka3.CS.Simple.TCP
1.0.2
See the version list below for details.
dotnet add package dmuka3.CS.Simple.TCP --version 1.0.2
NuGet\Install-Package dmuka3.CS.Simple.TCP -Version 1.0.2
<PackageReference Include="dmuka3.CS.Simple.TCP" Version="1.0.2" />
paket add dmuka3.CS.Simple.TCP --version 1.0.2
#r "nuget: dmuka3.CS.Simple.TCP, 1.0.2"
// Install dmuka3.CS.Simple.TCP as a Cake Addin #addin nuget:?package=dmuka3.CS.Simple.TCP&version=1.0.2 // Install dmuka3.CS.Simple.TCP as a Cake Tool #tool nuget:?package=dmuka3.CS.Simple.TCP&version=1.0.2
dmuka3.CS.Simple.TCP
This library provides you to send/receive byte[] on tcp easily.
Nuget
Link : https://www.nuget.org/packages/dmuka3.CS.Simple.TCP/
Install-Package dmuka3.CS.Simple.TCP
Example 1
You have to know that this library can't be used without .net tcp libraries. We just added somethings to be more useful.
Firstly, what to use this library for? Only to send and to receive byte[] via tcp. But we will use a different protocol to use this library. Don't worry, it's too ordionary technique.
Protocol
// PACKAGE = [1,2,3,4,5]
// PACKAGE LENGTH = 5
// TCP PACKAGE = [0, 0, 0, 5, 1, 2, 3, 4, 5]
I told you that it's too ordionary technique. We just added 4 byte(INT32) at beginning of package to get package length. After that, we will push the original package at the ending of package. Of course, we can't use this protocol to receive some datas from other services(HTTP, FTP, etc.). We can use this only personal purposes.
TcpListener server = new TcpListener(IPAddress.Any, 9875);
server.Start();
bool stopped = false;
bool test = false;
new Thread(() =>
{
var client = server.AcceptTcpClient();
var conn = new TCPClientConnection(client);
conn.Send(Encoding.UTF8.GetBytes("HELLO_SERVER"));
var msg = Encoding.UTF8.GetString(conn.Receive());
if (msg == "HELLO_CLIENT")
test = true;
stopped = true;
}).Start();
new Thread(() =>
{
var client = new TcpClient();
client.Connect("127.0.0.1", 9875);
var conn = new TCPClientConnection(client);
var msg = Encoding.UTF8.GetString(conn.Receive());
if (msg == "HELLO_SERVER")
conn.Send(Encoding.UTF8.GetBytes("HELLO_CLIENT"));
else
stopped = true;
}).Start();
while (!stopped)
Thread.Sleep(1);
server.Stop();
Assert.IsTrue(test);
Product | Versions 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 | netcoreapp3.0 is compatible. netcoreapp3.1 was computed. |
-
.NETCoreApp 3.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on dmuka3.CS.Simple.TCP:
Package | Downloads |
---|---|
dmuka3.CS.Simple.RamDb
Package Description |
|
dmuka3.CS.Simple.Queuing
Package Description |
|
dmuka3.CS.Simple.RemoteIO
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.