{"id":26864438,"url":"https://github.com/pasanbhanu/tcp-asynchronous-client","last_synced_at":"2025-05-06T22:41:22.336Z","repository":{"id":37396700,"uuid":"224615904","full_name":"PasanBhanu/tcp-asynchronous-client","owner":"PasanBhanu","description":"TCP Asynchronous Client DLL for C#. Send and Receive Data with TCP Server Asynchronously in C# Applications","archived":false,"fork":false,"pushed_at":"2019-12-02T07:12:37.000Z","size":50,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"update","last_synced_at":"2025-05-06T20:55:54.434Z","etag":null,"topics":["async","asynchronous-programming","csharp","tcp-client","tcp-socket"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PasanBhanu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-28T09:22:53.000Z","updated_at":"2024-01-19T14:13:55.000Z","dependencies_parsed_at":"2022-08-08T20:15:26.232Z","dependency_job_id":null,"html_url":"https://github.com/PasanBhanu/tcp-asynchronous-client","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PasanBhanu%2Ftcp-asynchronous-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PasanBhanu%2Ftcp-asynchronous-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PasanBhanu%2Ftcp-asynchronous-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PasanBhanu%2Ftcp-asynchronous-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PasanBhanu","download_url":"https://codeload.github.com/PasanBhanu/tcp-asynchronous-client/tar.gz/refs/heads/update","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252782436,"owners_count":21803378,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","asynchronous-programming","csharp","tcp-client","tcp-socket"],"created_at":"2025-03-31T03:39:20.654Z","updated_at":"2025-05-06T22:41:22.315Z","avatar_url":"https://github.com/PasanBhanu.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://i.ibb.co/YD7yF8g/image.png\"\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n \n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/PasanBhanu/tcp-asynchronous-client/issues)\n[![Nuget](https://img.shields.io/nuget/v/TCPAsynchronousClient)](https://www.nuget.org/packages/TCPAsynchronousClient)\n[![HitCount](http://hits.dwyl.com/dwyl/start-here.svg)](https://github.com/PasanBhanu/tcp-asynchronous-client)\n[![Nuget](https://img.shields.io/nuget/dt/TCPAsynchronousClient)](https://www.nuget.org/packages/TCPAsynchronousClient)\n\n\u003c/div\u003e\n\n# TCP Asynchronous Client for C#.NET\nTCP Asynchronous Client DLL for C#. Communicate with TCP Server in C# Applications. Simple and less resource usage model without multithreading or waitOne().\n\n## How To Use\nAdd the DLL to your project as a reference. Create a TCPAsyncClient Object and use the functions. Complete workable example is given in Sample Application\n\n## Constructors\n+ public AsynchronousClient(string _ip, int _port)\n\n## Functions Available\n+ void Connect() - Connect to the server\n+ bool Write(string _data) - Send data to server\n+ bool Write(byte[] _data) - Send data to server\n+ void Dispose() - Dispose socket/ connection\n+ void Disconnect() - Disconnect connection\n+ bool IsConnected() - Check is the socket connected\n\n## Callbacks\n+ Connection Status - **OnConnectEventHandler** -\u003e void OnConnect(bool status)\n+ Recieve Data - **DataReceivedEventHandler** -\u003e void OnRecieved(string data)\n\n## How To Use\n\n### Create Object\n````c#\nAsynchronousClient tcp = new AsynchronousClient(txtIpAddress.Text, int.Parse(txtPort.Text));\ntcp.OnConnectEvent += new AsynchronousClient.OnConnectEventHandler(OnConnect);\ntcp.OnDataRecievedEvent += new AsynchronousClient.DataReceivedEventHandler(OnRecieved);\ntcp.Connect();\n````\n\n#### Setup Connection Status Callback Function\n````c#\nprivate void OnConnect(bool status)\n{\n    Console.WriteLine(\"Connection Status : \" + status.ToString());\n}\n````\n\n#### Setup Data Recieved Callback Function\n````c#\nprivate void OnRecieved(string data)\n{\n    Console.WriteLine(\"Recieved Data : \" + data);\n}\n````\n\n### Write to TCP\n````c#\nprivate void WriteData(string data)\n{\n    try\n      {\n          if (tcp.Write(data))\n          {\n              Console.WriteLine(\"Write OK\");\n          }\n          else\n          {\n              Console.WriteLine(\"Write Failed\");\n          }\n      }catch(Exception ex)\n      {\n          // Catch errors in Sending Data\n          Console.WriteLine(\"Error : \" + ex.ToString());\n      }\n}\n````\n\n### Create TCP Server for Testing\nYou can use [Hercules Setup Utility](https://hercules-setup.soft32.com/) to create TCP server in Local Machine with few clicks. Here is an example.\n\n![Hercules TCP Server Sample](https://i.ibb.co/Dt241Fw/image.png)\n\n## Support\nThis application is developed using .NET Framework 4.6\n\n## Download\nPlease go to release page to download the stable version. We recommend not to use alpha or beta releases for your projects.\n\n## Contributing\nContributors are WELCOME!\n\n## License\nThe MIT License (MIT). Please see [License File](https://github.com/PasanBhanu/TCPAsynchronousClient/blob/master/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpasanbhanu%2Ftcp-asynchronous-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpasanbhanu%2Ftcp-asynchronous-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpasanbhanu%2Ftcp-asynchronous-client/lists"}