DotNetty.Extensions.Libuv
2.0.0
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.7.2
This package targets .NET Framework 4.7.2. The package is compatible with this framework or higher.
dotnet add package DotNetty.Extensions.Libuv --version 2.0.0
NuGet\Install-Package DotNetty.Extensions.Libuv -Version 2.0.0
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="DotNetty.Extensions.Libuv" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotNetty.Extensions.Libuv --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DotNetty.Extensions.Libuv, 2.0.0"
#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 DotNetty.Extensions.Libuv as a Cake Addin #addin nuget:?package=DotNetty.Extensions.Libuv&version=2.0.0 // Install DotNetty.Extensions.Libuv as a Cake Tool #tool nuget:?package=DotNetty.Extensions.Libuv&version=2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
https://gitee.com/znyet/dotnetty.extensions.libuv
//Tcp服务端
var server = new TcpSocketServer(8888);
server.OnPipeline(pipeline =>
{
//心跳
pipeline.AddLast(new IdleStateHandler(60, 0, 0));
//编码解码器
//pipeline.AddLast(new LengthFieldPrepender(2));
//pipeline.AddLast(new LengthFieldBasedFrameDecoder(ushort.MaxValue, 0, 2, 0, 2));
//tls证书
//var cert = new X509Certificate2(Path.Combine(ExampleHelper.ProcessDirectory, "dotnetty.com.pfx"), "password");
//pipeline.AddLast(TlsHandler.Server(cert));
});
server.OnStart(() =>
{
Console.WriteLine("服务启动成功");
});
server.OnConnectionConnect(conn =>
{
Console.WriteLine("OnConnectionConnect:" + conn.Id);
Console.WriteLine("当前连接数:" + server.GetConnectionCount());
});
server.OnConnectionReceive((conn, bytes) =>
{
Console.WriteLine("OnConnectionReceive:" + bytes);
conn.SendAsync(bytes);
});
server.OnConnectionException((conn, ex) =>
{
Console.WriteLine("OnConnectionException:" + ex);
});
server.OnConnectionClose(conn =>
{
Console.WriteLine("OnConnectionClose:" + conn.Id);
Console.WriteLine("当前连接数:" + server.GetConnectionCount());
});
server.OnStop(ex =>
{
Console.WriteLine(ex);
//restart
//server.StartAsync();
});
server.StartAsync();
//Tcp客户端
var client = new TcpSocketClient("127.0.0.1", 8888);
client.OnPipeline(pipeline =>
{
//心跳
//pipeline.AddLast(new IdleStateHandler(5, 0, 0));
//编码解码器
//pipeline.AddLast(new LengthFieldPrepender(2));
//pipeline.AddLast(new LengthFieldBasedFrameDecoder(ushort.MaxValue, 0, 2, 0, 2));
//tls证书
//var cert = new X509Certificate2(Path.Combine(ExampleHelper.ProcessDirectory, "dotnetty.com.pfx"), "password");
//var targetHost = cert.GetNameInfo(X509NameType.DnsName, false);
//pipeline.AddLast(new TlsHandler(stream => new SslStream(stream, true, (sender, certificate, chain, errors) => true), new ClientTlsSettings(targetHost)));
});
client.OnConnect(() =>
{
Console.WriteLine("OnConnect");
var bytes = Encoding.UTF8.GetBytes("Hello Word");
client.SendAsync(bytes);
});
client.OnReceive(bytes =>
{
Console.WriteLine("OnReceive:" + bytes);
});
client.OnException(ex =>
{
Console.WriteLine("OnException:" + ex);
});
client.OnClose(ex =>
{
Console.WriteLine("OnClose:" + ex);
//restart
//client.ConnectAsync();
});
client.ConnectAsync();
//UDP服务
var udp = new UdpSocket(7777);
udp.OnStart(() =>
{
Console.WriteLine("UDP服务启动7777");
var endPiont = new IPEndPoint(IPAddress.Broadcast, 8888);
var bytes = Encoding.UTF8.GetBytes("您好");
udp.SendAsync(endPiont, bytes);
});
udp.OnRecieve(async (endPoint, bytes) =>
{
Console.WriteLine(endPoint);
Console.WriteLine(Encoding.UTF8.GetString(bytes));
});
udp.OnException(ex =>
{
Console.WriteLine(ex);
});
udp.OnStop(ex =>
{
Console.WriteLine("Close:" + ex);
//restart
//udp.StartAsync();
});
udp.StartAsync();
//WebSocket服务端
var server = new WebSocketServer(8888);
server.OnPipeline(pipeline =>
{
//心跳
//pipeline.AddLast(new IdleStateHandler(5, 0, 0));
//tls证书
//var cert = new X509Certificate2(Path.Combine(ExampleHelper.ProcessDirectory, "dotnetty.com.pfx"), "password");
//pipeline.AddLast(TlsHandler.Server(cert));
});
server.OnStart(() =>
{
Console.WriteLine("服务启动成功");
});
server.OnConnectionConnect(conn =>
{
Console.WriteLine("OnConnectionConnect:" + conn.Id);
Console.WriteLine("当前连接数:" + server.GetConnectionCount());
conn.SendTextAsync("嘿,欢迎来到服务器");
});
server.OnConnectionReceiveText((conn, text) =>
{
Console.WriteLine("OnConnectionReceiveText:" + text);
});
server.OnConnectionReceiveBinary((conn, bytes) =>
{
Console.WriteLine("OnConnectionReceiveBinary:" + bytes);
});
server.OnConnectionException((conn, ex) =>
{
Console.WriteLine("OnConnectionException:" + ex);
});
server.OnConnectionClose(conn =>
{
Console.WriteLine("OnConnectionClose:" + conn.Id);
Console.WriteLine("当前连接数:" + server.GetConnectionCount());
});
server.OnStop(ex =>
{
Console.WriteLine(ex);
//restart
//server.StartAsync();
});
server.StartAsync();
//WebSocket客户端
var client = new WebSocketClient("ws://127.0.0.1:8888");
client.OnPipeline(pipeline =>
{
//心跳
//pipeline.AddLast(new IdleStateHandler(5, 0, 0));
//tls证书
//var cert = new X509Certificate2(Path.Combine(ExampleHelper.ProcessDirectory, "dotnetty.com.pfx"), "password");
//var targetHost = cert.GetNameInfo(X509NameType.DnsName, false);
//pipeline.AddLast(new TlsHandler(stream => new SslStream(stream, true, (sender, certificate, chain, errors) => true), new ClientTlsSettings(targetHost)));
});
client.OnConnect(() =>
{
Console.WriteLine("OnConnect");
client.SendTextAsync("Hello Word");
client.SendBinaryAsync(new byte[] { 1 });
});
client.OnReceiveText(text =>
{
Console.WriteLine("OnReceiveText:" + text);
});
client.OnReceiveBinary(bytes =>
{
Console.WriteLine("OnReceiveBinary:" + bytes);
});
client.OnException(ex =>
{
Console.WriteLine("OnException:" + ex);
});
client.OnClose(ex =>
{
Console.WriteLine("OnClose:" + ex);
//restart
//client.ConnectAsync();
});
client.ConnectAsync();
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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.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 is compatible. 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.
-
.NETFramework 4.7.2
- DotNetty.Codecs.Http (>= 0.7.0)
- DotNetty.Handlers (>= 0.7.0)
- DotNetty.Transport.Libuv (>= 0.7.0)
-
.NETStandard 2.0
- DotNetty.Codecs.Http (>= 0.7.0)
- DotNetty.Handlers (>= 0.7.0)
- DotNetty.Transport.Libuv (>= 0.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.