https://github.com/ivan-sincek/chat-app
Multithreading TCP server and client communicating over TCP/IP - Windows Forms Application.
https://github.com/ivan-sincek/chat-app
c-sharp chat-application multithreading networking tcp-client tcp-server visual-studio windows windows-forms
Last synced: about 1 year ago
JSON representation
Multithreading TCP server and client communicating over TCP/IP - Windows Forms Application.
- Host: GitHub
- URL: https://github.com/ivan-sincek/chat-app
- Owner: ivan-sincek
- License: mit
- Archived: true
- Created: 2019-02-12T07:44:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-08-04T07:31:25.000Z (almost 5 years ago)
- Last Synced: 2025-03-29T05:34:53.831Z (about 1 year ago)
- Topics: c-sharp, chat-application, multithreading, networking, tcp-client, tcp-server, visual-studio, windows, windows-forms
- Language: C#
- Homepage:
- Size: 88.9 KB
- Stars: 52
- Watchers: 4
- Forks: 20
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Chat App
Windows Forms Application made in Visual Studio Community 2019 v16.7.6 and written in C# (.NET Framework v4.6.1).
Application is made for sole purpose of showing how to implement `TcpListener` and `TcpClient` classes, as well as asynchronous read and write functions.
Used `ConcurrentDictionary` class which is a thread-safe collection of key/value pairs to store client information.
Used `Task` class to prevent race conditions.
Server uses multithreading to accept clients (i.e. server can accept multiple clients).
Check the code in these two files:
* [/src/Server/Server/Server.cs](https://github.com/ivan-sincek/chat-app/blob/master/src/Server/Server/Server.cs)
* [/src/Client/Client/Client.cs](https://github.com/ivan-sincek/chat-app/blob/master/src/Client/Client/Client.cs)
Tested on Windows 10 Enterprise OS (64-bit).
Made for educational purposes. I hope it will help!
Future plans:
* create server and client classes,
* ~~option to hide the key field.~~
## How to Run
Run Server.exe and Client.exe.
---
You can use [ngrok](https://ngrok.com) to give your server a public address:
```fundamental
ngrok.exe tcp 9000
```
For more options run `ngrok.exe -h`.
## Images

Figure 1 - Server

Figure 2 - Client