Warning
This code is not maintained here anymore and has moved to GitLab.
For the most up-to-date code, visit the GitLab repository.
A terminal-based chat server written in C#.
Recreated from a Go project I did last year.
Warning
Only Tested on Linux PopOS!
Listens for connections & messages, logs in real-time.
Steve sends a message to the server.
Nick sends a message to the server.
.NET 9 SDK
Compatible terminal environment (Linux, macOS, Windows)
- Open a terminal and navigate to the project root directory.
- Run:
dotnet run --project CSharpStream server
- The server listens on port 8000 by default.
- Press
Ctrl+C
to gracefully stop the server.
- Open a new terminal window.
- Run:
dotnet run --project CSharpStream client
- When prompted, enter your username.
- Type messages and press Enter to send them to the chat.
CSharpStream.Server
– TCP server implementation handling client connections and message broadcasting.CSharpStream.Client
– TCP client implementation for sending and receiving chat messages.CSharpStream.Models
– Contains theMessage
andUser
models, used for structured data transfer and managing user identity information.ChatServer.cs
- Works as the service layer.Program.cs
- Starts client/server based on command line arguments.
- Ensure no firewall or network restrictions block port 8000.
- If connection is refused, verify the server is running before starting clients.
- Use
Ctrl+C
to exit clients and server cleanly.