DotNetty | DotNetty project – a port | TCP library

 by   Azure C# Version: v0.4.0 License: Non-SPDX

kandi X-RAY | DotNetty Summary

DotNetty is a C# library typically used in Networking, TCP applications. DotNetty has no bugs, it has no vulnerabilities and it has medium support. However DotNetty has a Non-SPDX License. You can download it from GitHub.
DotNetty is a port of Netty, asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients.
    Support
      Quality
        Security
          License
            Reuse
            Support
              Quality
                Security
                  License
                    Reuse

                      kandi-support Support

                        summary
                        DotNetty has a medium active ecosystem.
                        summary
                        It has 3767 star(s) with 937 fork(s). There are 414 watchers for this library.
                        summary
                        It had no major release in the last 12 months.
                        summary
                        There are 151 open issues and 214 have been closed. On average issues are closed in 182 days. There are 13 open pull requests and 0 closed requests.
                        summary
                        It has a neutral sentiment in the developer community.
                        summary
                        The latest version of DotNetty is v0.4.0
                        DotNetty Support
                          Best in #TCP
                            Average in #TCP
                            DotNetty Support
                              Best in #TCP
                                Average in #TCP

                                  kandi-Quality Quality

                                    summary
                                    DotNetty has 0 bugs and 0 code smells.
                                    DotNetty Quality
                                      Best in #TCP
                                        Average in #TCP
                                        DotNetty Quality
                                          Best in #TCP
                                            Average in #TCP

                                              kandi-Security Security

                                                summary
                                                DotNetty has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
                                                summary
                                                DotNetty code analysis shows 0 unresolved vulnerabilities.
                                                summary
                                                There are 0 security hotspots that need review.
                                                DotNetty Security
                                                  Best in #TCP
                                                    Average in #TCP
                                                    DotNetty Security
                                                      Best in #TCP
                                                        Average in #TCP

                                                          kandi-License License

                                                            summary
                                                            DotNetty has a Non-SPDX License.
                                                            summary
                                                            Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.
                                                            DotNetty License
                                                              Best in #TCP
                                                                Average in #TCP
                                                                DotNetty License
                                                                  Best in #TCP
                                                                    Average in #TCP

                                                                      kandi-Reuse Reuse

                                                                        summary
                                                                        DotNetty releases are available to install and integrate.
                                                                        DotNetty Reuse
                                                                          Best in #TCP
                                                                            Average in #TCP
                                                                            DotNetty Reuse
                                                                              Best in #TCP
                                                                                Average in #TCP
                                                                                  Top functions reviewed by kandi - BETA
                                                                                  kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
                                                                                  Currently covering the most popular Java, JavaScript and Python libraries. See a Sample Here
                                                                                  Get all kandi verified functions for this library.
                                                                                  Get all kandi verified functions for this library.

                                                                                  DotNetty Key Features

                                                                                  DotNetty project – a port of netty, event-driven asynchronous network application framework

                                                                                  DotNetty Examples and Code Snippets

                                                                                  No Code Snippets are available at this moment for DotNetty.
                                                                                  Community Discussions

                                                                                  Trending Discussions on DotNetty

                                                                                  Azure DeviceClient does not shut down dotnetty threads on program exit
                                                                                  chevron right
                                                                                  Akka.net: Should I specify "split brain resolver" configuration for Lighthouse/Seed nodes
                                                                                  chevron right
                                                                                  How to set DotNetty(Netty) Bootstrap.ConnectAsync timeout?
                                                                                  chevron right
                                                                                  Which version of Netty does DotNetty 0.6.0 align with?
                                                                                  chevron right

                                                                                  QUESTION

                                                                                  Azure DeviceClient does not shut down dotnetty threads on program exit
                                                                                  Asked 2022-Jan-25 at 22:08

                                                                                  When using Microsoft.Azure.Devices.Client.DeviceClient .net framework 4.8 closing out the application leaves multiple Threads running. Specifically DotNetty.Common.dll! DotNetty.Common.Concurrency.SingleThreadEventExecutor.PollTask

                                                                                  Versions 1.34.0 & 1.35.0 of Microsoft.Azure.Devices have this same problem. Are we using DeviceClient improperly? Is it a async thing im not understanding? Am i missing a call to shut it down properly?

                                                                                  From examples online, i shouldn't have to do anything special and it should close it self out. However it still hangs, currently this is a close implementation. I have yet to make a stand alone, so i havent duplicated this problem with only DeviceClient Code running

                                                                                  When the program exits, is_running gets set, and the program closes down other threads. Eventually we call Environment.Exit(0);

                                                                                  This should be all the relevant code

                                                                                  private void thread_method()
                                                                                  {
                                                                                      using (var _deviceClient = DeviceClient.CreateFromConnectionString(connection), TransportType.Mqtt))
                                                                                      {
                                                                                          while (is_running)
                                                                                          {
                                                                                              var db = new Database(); // roughly an open entity framework connection
                                                                                              List  unprocessed_messages = db.GetUnprocessed();
                                                                                              List> processed = breakup_method(unprocessed_messages);
                                                                                              foreach (var sublist in processed) 
                                                                                              {
                                                                                  
                                                                                                  if (!await SendMessages(sublist , _deviceClient))
                                                                                                      break;
                                                                                                  // the processed sublist was successful
                                                                                                  db.SaveChanges(); // make sure we dont send again
                                                                                              }
                                                                                  
                                                                                          }
                                                                                          Thread.Sleep(500);
                                                                                  
                                                                                          await _deviceClient.CloseAsync();
                                                                                      }
                                                                                  }
                                                                                  private async Task SendMessages(List messages, DeviceClient _deviceClient)
                                                                                  {
                                                                                      try
                                                                                      {
                                                                                          CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(5000);
                                                                                          CancellationToken cancellationToken = cancellationTokenSource.Token;
                                                                                  
                                                                                          await _deviceClient.SendEventBatchAsync(messages, cancellationToken);
                                                                                  
                                                                                          if (cancellationToken.IsCancellationRequested)
                                                                                              return false;
                                                                                          return true;
                                                                                      }
                                                                                      catch (Exception e)
                                                                                      {
                                                                                          // logging
                                                                                      }
                                                                                      return false;
                                                                                  }
                                                                                  

                                                                                  Different approach, which doesnt actively send anything. Just an open , sleep until the program exits, Then close, All in a using statement. 8 threads are still running the PollTask, and in the amount of time it took to setup everything above, was the time i was waiting for them to close. Which was at least 5 minutes.

                                                                                  
                                                                                  private void thread_method()
                                                                                  {   
                                                                                     using (var _deviceClient = DeviceClient.CreateFromConnectionString(connection), TransportType.Mqtt))
                                                                                      {
                                                                                         await _deviceClient.OpenAsync();
                                                                                         while (is_running) Thread.Sleep(500);
                                                                                         await _deviceClient.CloseAsync();
                                                                                      }
                                                                                  
                                                                                  }
                                                                                  
                                                                                  

                                                                                  Last update, stand alone console app. 100% not my problem.

                                                                                  // Repost just in case
                                                                                  class Program
                                                                                  {
                                                                                  private static string _connection_string = $"HostName={url};DeviceId={the_id};SharedAccesskey={key}";// fill your in
                                                                                      public static bool is_running = false;
                                                                                      static void Main(string[] args)
                                                                                      {
                                                                                  
                                                                                          is_running = true;
                                                                                          new System.Threading.Thread(new System.Threading.ThreadStart(thread_method)).Start();
                                                                                          Console.WriteLine("enter to exit");
                                                                                          String line = Console.ReadLine();
                                                                                          is_running = false;
                                                                                      }
                                                                                      public static async void thread_method()
                                                                                      {
                                                                                          using (var _deviceClient = DeviceClient.CreateFromConnectionString(_connection_string, TransportType.Mqtt))
                                                                                          {
                                                                                              await _deviceClient.OpenAsync();
                                                                                              while (is_running) System.Threading.Thread.Sleep(500);
                                                                                              await _deviceClient.CloseAsync();
                                                                                          }
                                                                                          }
                                                                                  }
                                                                                  

                                                                                  ANSWER

                                                                                  Answered 2022-Jan-25 at 22:08

                                                                                  https://github.com/Azure/azure-sdk-for-net/issues/24550 https://github.com/Azure/azure-iot-sdk-csharp/issues/2194

                                                                                  Not a configuration issue, a 'dot netty' bug was hanging. The fix, get a newer azure version Microsoft.Azure.Devices > 1.35.0

                                                                                  Source https://stackoverflow.com/questions/69485035

                                                                                  QUESTION

                                                                                  Akka.net: Should I specify "split brain resolver" configuration for Lighthouse/Seed nodes
                                                                                  Asked 2021-Sep-17 at 16:36

                                                                                  I have this application using Akka.net cluster feature. The people who wrote the code have left the company. I am trying to understand the code and we are planning a deployment.

                                                                                  The cluster has 2 types of nodes

                                                                                  QueueServicer: supports sharding and only these nodes should participate in sharding.
                                                                                  LightHouse: They are just seed nodes, nothing else.

                                                                                  Lighthouse : 2 nodes
                                                                                  QueueServicer : 3 Nodes

                                                                                  I see one of the QueueServicer node unable to join the cluster. Both lighthouse nodes are refusing connection. It constantly tries to join and never succeeds. This has been happening for the last 5 days or so and the node is never dying also. Its CPU and memory usage is high. Also It doesn't have any queue processor actors running when filtered search through the log. It takes long hours for Garbage collection etc. I see in the log for this node, the following.

                                                                                  {"timestamp":"2021-09-08T22:26:59.025Z", "logger":"Akka.Event.DummyClassForStringSources", "message":Tried to associate with unreachable remote address [akka.tcp://myapp@lighthouse-1:7892]. Address is now gated for 5000 ms, all messages to this address will be delivered to dead letters. Reason: [Association failed with akka.tcp://myapp@lighthouse-1:7892] Caused by: [System.AggregateException: One or more errors occurred. (Connection refused akka.tcp://myapp@lighthouse-1:7892) ---> Akka.Remote.Transport.InvalidAssociationException: Connection refused akka.tcp://myapp@lighthouse-1:7892 at Akka.Remote.Transport.DotNetty.TcpTransport.AssociateInternal(Address remoteAddress) at Akka.Remote.Transport.DotNetty.DotNettyTransport.Associate(Address remoteAddress) --- End of inner exception stack trace --- at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Akka.Remote.Transport.ProtocolStateActor.<>c.b__12_18(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

                                                                                  {"timestamp":"2021-09-08T22:26:59.025Z", "logger":"Akka.Event.DummyClassForStringSources", "message":Tried to associate with unreachable remote address [akka.tcp://myapp@lighthouse-0:7892]. Address is now gated for 5000 ms, all messages to this address will be delivered to dead letters. Reason: [Association failed with akka.tcp://myapp@lighthouse-0:7892] Caused by: [System.AggregateException: One or more errors occurred. (Connection refused akka.tcp://myapp@lighthouse-0:7892) ---> Akka.Remote.Transport.InvalidAssociationException: Connection refused akka.tcp://myapp@lighthouse-0:7892 at Akka.Remote.Transport.DotNetty.TcpTransport.AssociateInternal(Address remoteAddress) at Akka.Remote.Transport.DotNetty.DotNettyTransport.Associate(Address remoteAddress) --- End of inner exception stack trace --- at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Akka.Remote.Transport.ProtocolStateActor.<>c.b__12_18(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

                                                                                  There are other "Now supervising", "Stopping" "Started" logs which I am omitting here.

                                                                                  Can you please verify if the HCON config is correct for split brain resolver and Sharding?

                                                                                  I think LightHouse/SeeNodes should not have the sharding configuration specified. I think it is a mistake. I also think, split brain resolver configuration might be wrong in LightHouse/SeedNodes and should not be specified for seed nodes.

                                                                                  I appreciate your help.

                                                                                  Here is the HOCON for QueueServicer Trimmed

                                                                                  akka {
                                                                                      loggers = ["Akka.Logger.log4net.Log4NetLogger, Akka.Logger.log4net"]
                                                                                      log-config-on-start = on
                                                                                      loglevel = "DEBUG"
                                                                                      actor {
                                                                                          provider = cluster
                                                                                          serializers {
                                                                                              hyperion = "Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion"
                                                                                          }
                                                                                          serialization-bindings {
                                                                                              "System.Object" = hyperion
                                                                                          }
                                                                                      }

                                                                                  remote {
                                                                                      dot-netty.tcp {
                                                                                      ….
                                                                                      }
                                                                                  }
                                                                                  
                                                                                  cluster {
                                                                                      seed-nodes = ["akka.tcp://myapp@lighthouse-0:7892",akka.tcp://myapp@lighthouse-1:7892"]
                                                                                      roles = ["QueueProcessor"]
                                                                                      sharding {
                                                                                          role = "QueueProcessor"
                                                                                          state-store-mode = ddata
                                                                                          remember-entities = true
                                                                                          passivate-idle-entity-after = off
                                                                                      }
                                                                                  
                                                                                      downing-provider-class = "Akka.Cluster.SplitBrainResolver, Akka.Cluster"
                                                                                      split-brain-resolver {
                                                                                                                 active-strategy = keep-majority
                                                                                                                 stable-after = 20s
                                                                                          keep-majority {
                                                                                              role = "QueueProcessor"
                                                                                          }
                                                                                       }
                                                                                      down-removal-margin = 20s
                                                                                  }
                                                                                  
                                                                                  extensions = ["Akka.Cluster.Tools.PublishSubscribe.DistributedPubSubExtensionProvider,Akka.Cluster.Tools"]
                                                                                  

                                                                                  }

                                                                                  Here is the HOCON for Lighthouse

                                                                                  akka {
                                                                                      loggers = ["Akka.Logger.log4net.Log4NetLogger, Akka.Logger.log4net"]
                                                                                      log-config-on-start = on
                                                                                      loglevel = "DEBUG"
                                                                                      actor {
                                                                                          provider = cluster
                                                                                          serializers {
                                                                                              hyperion = "Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion"
                                                                                          }
                                                                                          serialization-bindings {
                                                                                              "System.Object" = hyperion
                                                                                          }
                                                                                      }

                                                                                  remote {
                                                                                      dot-netty.tcp {
                                                                                      …
                                                                                      }
                                                                                  }
                                                                                  
                                                                                  cluster {
                                                                                      seed-nodes = ["akka.tcp://myapp@lighthouse-0:7892",akka.tcp://myapp@lighthouse-1:7892"]
                                                                                      roles = ["lighthouse"]
                                                                                      sharding {
                                                                                          role = "lighthouse"
                                                                                          state-store-mode = ddata
                                                                                          remember-entities = true
                                                                                          passivate-idle-entity-after = off
                                                                                      }
                                                                                  
                                                                                      downing-provider-class = "Akka.Cluster.SplitBrainResolver, Akka.Cluster"
                                                                                      split-brain-resolver {
                                                                                                                    active-strategy = keep-oldest
                                                                                                                    stable-after = 30s
                                                                                                keep-oldest {
                                                                                              down-if-alone = on
                                                                                              role = "lighthouse"
                                                                                                }
                                                                                        }
                                                                                   }
                                                                                  

                                                                                  }

                                                                                  ANSWER

                                                                                  Answered 2021-Sep-17 at 16:36

                                                                                  I meant to reply to this sooner.

                                                                                  Here is your problem: you're using two different split brain resolver configurations - one for the QueueServicer and one for Lighthouse. Therefore, how your cluster resolves itself is going to be quite different depending upon who is the leader of each half of the cluster.

                                                                                  I would stick with a simple keep-majority strategy and use it uniformly on all nodes throughout the cluster - we're very likely going to enable this by default in Akka.NET v1.5.

                                                                                  If you have any questions, please feel free to reach out to us: https://petabridge.com/

                                                                                  Source https://stackoverflow.com/questions/69110696

                                                                                  QUESTION

                                                                                  How to set DotNetty(Netty) Bootstrap.ConnectAsync timeout?
                                                                                  Asked 2021-Mar-27 at 21:02

                                                                                  I'm using DotNetty in Unity, and has the following client bootstrap, when the server is down, it will take the "clientBootstrap.ConnectAsync()" around 17 seconds to give up trying to establish a connection, during which, the client is frozen. Actually, it doesn't need to try for 17 seconds to know there can be no connection. How can I configurate so the "clientBootstrap.ConnectAsync()" trys only for maybe 5 seconds? I added ".Option(ChannelOption.ConnectTimeout, TimeSpan.FromMilliseconds(5000))", but still, it takes 17 seconds to stop trying. The option only triggered an extra timeout exception.

                                                                                      try
                                                                                      {
                                                                                          var clientBootstrap = new Bootstrap();
                                                                                          clientBootstrap
                                                                                              .Group(group)
                                                                                              .Channel()
                                                                                              .Option(ChannelOption.TcpNodelay, true)
                                                                                              .Option(ChannelOption.ConnectTimeout, TimeSpan.FromMilliseconds(1000))
                                                                                              .Handler(new ActionChannelInitializer(channel =>
                                                                                              {
                                                                                                  var pipeline = channel.Pipeline;
                                                                                                  pipeline.AddLast(new IdleStateHandler(0, 0, 6));
                                                                                                  ......
                                                                                              }));
                                                                                          clientChannel = await clientBootstrap.ConnectAsync(new IPEndPoint(IPAddress.Parse(IP), Port));
                                                                                  

                                                                                  Thank you very much.

                                                                                  ANSWER

                                                                                  Answered 2021-Mar-27 at 21:02

                                                                                  You should be able to set a timeout according to this:

                                                                                  Not familiar with dotnetty but applied to your snippet I would try something like:

                                                                                  try
                                                                                  {
                                                                                      var clientBootstrap = new Bootstrap();
                                                                                      clientBootstrap
                                                                                          .Group(group)
                                                                                          .Channel()
                                                                                          .Option(ChannelOption.TcpNodelay, true)
                                                                                          .Option(ChannelOption.ConnectTimeout, TimeSpan.FromMilliseconds(1000))
                                                                                          .Handler(new ActionChannelInitializer(channel =>
                                                                                          {
                                                                                              var pipeline = channel.Pipeline;
                                                                                              pipeline.AddLast(new IdleStateHandler(0, 0, 6));
                                                                                              ......
                                                                                          }));
                                                                                      
                                                                                      int timeout = 5000;
                                                                                      var clientChannel = clientBootstrap.ConnectAsync(new IPEndPoint(IPAddress.Parse(IP), Port));
                                                                                      if (await Task.WhenAny(clientChannel, Task.Delay(timeout)) == clientChannel) {
                                                                                          // task completed within timeout
                                                                                      } else { 
                                                                                          // timeout logic
                                                                                      }
                                                                                  }
                                                                                  

                                                                                  Useful to read task delay documentation:

                                                                                  Source https://stackoverflow.com/questions/66706343

                                                                                  QUESTION

                                                                                  Which version of Netty does DotNetty 0.6.0 align with?
                                                                                  Asked 2021-Mar-14 at 13:32

                                                                                  As we know that DotNetty is a port of Netty to .net, I searched a lot, but couldn't find out which version of Netty is equal to the DotNetty 0.6.0 (latest DotNetty version).

                                                                                  If it's Netty 5, then there might be some problems, Netty 5 was abandoned.

                                                                                  Thanks.

                                                                                  ANSWER

                                                                                  Answered 2021-Mar-14 at 13:32

                                                                                  As far as I know its netty 4.1.x. Not sure what exact version tho

                                                                                  Source https://stackoverflow.com/questions/66543236

                                                                                  Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                                                                                  Vulnerabilities

                                                                                  No vulnerabilities reported

                                                                                  Install DotNetty

                                                                                  You can download it from GitHub.

                                                                                  Support

                                                                                  We gladly accept community contributions.
                                                                                  Find more information at:
                                                                                  Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
                                                                                  Find more libraries
                                                                                  Explore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits​
                                                                                  Save this library and start creating your kit
                                                                                  CLONE
                                                                                • HTTPS

                                                                                  https://github.com/Azure/DotNetty.git

                                                                                • CLI

                                                                                  gh repo clone Azure/DotNetty

                                                                                • sshUrl

                                                                                  git@github.com:Azure/DotNetty.git

                                                                                • Share this Page

                                                                                  share link

                                                                                  Explore Related Topics

                                                                                  Consider Popular TCP Libraries

                                                                                  masscan

                                                                                  by robertdavidgraham

                                                                                  wait-for-it

                                                                                  by vishnubob

                                                                                  gnet

                                                                                  by panjf2000

                                                                                  Quasar

                                                                                  by quasar

                                                                                  mumble

                                                                                  by mumble-voip

                                                                                  Try Top Libraries by Azure

                                                                                  autorest

                                                                                  by AzureTypeScript

                                                                                  MachineLearningNotebooks

                                                                                  by AzureJupyter Notebook

                                                                                  azure-sdk-for-python

                                                                                  by AzurePython

                                                                                  Compare TCP Libraries with Highest Support

                                                                                  pymodbus

                                                                                  by riptideio

                                                                                  masscan

                                                                                  by robertdavidgraham

                                                                                  frr

                                                                                  by FRRouting

                                                                                  mumble

                                                                                  by mumble-voip

                                                                                  freeswitch

                                                                                  by signalwire

                                                                                  Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
                                                                                  Find more libraries
                                                                                  Explore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits​
                                                                                  Save this library and start creating your kit