Skip to content

Sieep-Coding/simple-chat-csharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warning

This code is not maintained here anymore and has moved to GitLab.

For the most up-to-date code, visit the GitLab repository.

Simple Chat Server

A terminal-based chat server written in C#.

Recreated from a Go project I did last year.

Warning

Only Tested on Linux PopOS!

License: MIT PopOS Passing wakatime

Server

Listens for connections & messages, logs in real-time.

Client

Steve sends a message to the server.

Nick sends a message to the server.

Guide

Requirements

.NET 9 SDK

Compatible terminal environment (Linux, macOS, Windows)

Running the Server

  • 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.

Running the Client

  • 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.

Project Structure

  • 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 the Message and User 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.

Troubleshooting

  • 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.

License

MIT License

About

A simple chat server written in C#

Resources

License

Stars

Watchers

Forks

Languages