DotNetty.Extensions 2.0.0

There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package DotNetty.Extensions --version 2.0.0                
NuGet\Install-Package DotNetty.Extensions -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" 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 --version 2.0.0                
#r "nuget: DotNetty.Extensions, 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 as a Cake Addin
#addin nuget:?package=DotNetty.Extensions&version=2.0.0

// Install DotNetty.Extensions as a Cake Tool
#tool nuget:?package=DotNetty.Extensions&version=2.0.0                
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();

```csharp
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();

```csharp
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();
```csharp
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();
```csharp
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 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

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.2 570 8/21/2021
1.0.6 405 8/21/2021