AsyncTcpClient | asynchronous variant of TcpClient and TcpListener for .NET | TCP library

 by   ygoe C# Version: Current License: No License

kandi X-RAY | AsyncTcpClient Summary

kandi X-RAY | AsyncTcpClient Summary

AsyncTcpClient is a C# library typically used in Networking, TCP applications. AsyncTcpClient has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

Building asynchronous solutions with TcpClient and TcpListener is complicated and it is easy to introduce bugs or miss critical features. These classes provide an easy solution for this task. Writing asynchronous TCP/IP clients and servers with these classes only requires the implementation of very basic callbacks. Alternatively, you can implement your connection logic in derived classes. In any case, you just have to read the received data from a buffer and send data back. All socket and stream interaction is hidden from you. This also includes an asynchronous byte buffer that keeps all received bytes as they come in. Applications can dequeue as many bytes as they need without discarding what else was received. Dequeueing returns up to as many bytes as are available when called synchronously, or exactly the requested number of bytes when called asynchronously. The async method can be cancelled. This ensures that the code will never block irrecoverably. A complete example of both implementation styles is provided in the application in this repository. Start reading at Program.cs.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              AsyncTcpClient has a low active ecosystem.
              It has 95 star(s) with 23 fork(s). There are 11 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 3 open issues and 6 have been closed. On average issues are closed in 231 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of AsyncTcpClient is current.

            kandi-Quality Quality

              AsyncTcpClient has 0 bugs and 0 code smells.

            kandi-Security Security

              AsyncTcpClient has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              AsyncTcpClient code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              AsyncTcpClient does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              AsyncTcpClient releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            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 of AsyncTcpClient
            Get all kandi verified functions for this library.

            AsyncTcpClient Key Features

            No Key Features are available at this moment for AsyncTcpClient.

            AsyncTcpClient Examples and Code Snippets

            No Code Snippets are available at this moment for AsyncTcpClient.

            Community Discussions

            QUESTION

            Asio async_read_until EOF Error in Asynchronous TCP Server
            Asked 2022-Mar-23 at 02:22

            when I build it, and running server and then run client, that appear a error error code = 2, error message = End of file

            when I code synchronous tcp server it's work ok;

            thanks

            full client code

            ...

            ANSWER

            Answered 2022-Mar-23 at 02:22

            The server closes the connection after sending the (empty) response. That leads to EOF on the client, naturally. Just handle it.

            There's loads of code smells

            • delete this; is an abomination, just make Service shared_from_this.

            • No need to use shared_ptrs other than that

            • When you use smart pointers, use them. Don't "convert to raw pointer" just to dereference (so *m_socket instead of *m_socket.get()).

            • In fact, there should be no need to use new, delete or get() in your code

            • You are accessing the m_request immediately after async_read_until which is too early,

              • it is a data race (so Undefined Behaviour)
              • it doesn't get the request, because async_read_until didn't complete yet.

              So move that code into onRequestReceived at a minimum

            • It's pretty unnecessary to use an istream to read the line from the request when you already have bytes_transferred. I'd suggest

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

            QUESTION

            How should I use async_read_until and async_write simultaneously in the client app in boost::asio?
            Asked 2021-Jan-31 at 14:26
            My motivation.

            I am trying to build a simple messenger. Currently I have written client and server apps that support "mail like functional", that is they lack chat interaction that you have in every instant messenger.

            Here is a model I use.

            Server: The server for every connected client has a dedicated Service class that provides actual service. An instance of the Service class has an id.

            Client: At particular moment simultaneously starts reading messages from and writing messages to the associated Service instance.

            Tracker: Records current sessions of users by saving their logins and Service ids in a map. Also records opened chats by saving key-value pairs (chat participant id 1, chat participant id 2). I use logins and ids of users interchangeably because I have a database.

            Here is a typical usage scenario.
            1. A user is trying to log in. The server dedicates to the user the Service instance with id 1. Then the user identified as Bob.
            2. Bob opens a chat with Ann. Tracker records that Bob uses Service 1 and that Bob opened the chat with Ann.
            3. A user is trying to log in. The server dedicates to the user the Service instance with id 2. Then the user identified as Ann.
            4. Ann opens a chat with Bob. Tracker records that Ann uses Service 2 and that Ann opened the chat with Bob.
            5. Ann writes a message to Bob. Service 2 receives the message and asks Service 1 to send the message to Bob's chat if Bob has opened the chat with Ann. For that purpose I use Tracker. In our case Bob is in the chat so Bob's client app should read the message from Service 1. Otherwise Service 2 only stores the new message in the database.

            When a user opens a chat with somebody the client app simultaneously starts reading and writing messages to the associate Service instance.

            Issue
            1. Bob opens a chat with Ann. Ann opens a chat with Bob.
            2. Ann sends messages. They are displayed in Bobs chat.
            3. Bob sends a message. It is not displayed in Ann's chat. Moreover, further Ann's messages are no longer displayed in Bob's chat.

            Here is a portion of my server code. I have added some context but you probably want to look at Service::onMessageReceived, Service::receive_message, Service::send_to_chat

            ...

            ANSWER

            Answered 2021-Jan-31 at 14:26

            There's too much code and too little. Too much for the question, and too little to actually suggest improvements. I see an overuse of shared_ptr, threads, In particular it is very weird to run async-operations on their own threads. Let alone detached:

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install AsyncTcpClient

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/ygoe/AsyncTcpClient.git

          • CLI

            gh repo clone ygoe/AsyncTcpClient

          • sshUrl

            git@github.com:ygoe/AsyncTcpClient.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            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 ygoe

            HyperVSwitch

            by ygoeC#

            msgpack.js

            by ygoeJavaScript

            T-Clock

            by ygoeC

            TxTranslation

            by ygoeC#