Skip to content
uasuna2022Public

About

A real-time desktop multi-user chat application built with C#, .NET 8.0, and WPF using TCP sockets and a custom JSON messaging protocol.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Group Chat

C# .NET WPF TCP Sockets JSON

A real-time desktop Group Chat application built with C#, .NET, and WPF. It enables users to host TCP chat servers and connect as client instances for multi-user chat room communication using a custom asynchronous JSON messaging protocol.


Demonstration

Demonstration


Key Features

In this application, you can:

  • Host your own chat server: Set up a custom server with your preferred IP address, port, admin nickname, and password.
  • Monitor server activity: View real-time logs of server events, incoming connections, and user messages in the server dashboard.
  • Manage connected users: See who is currently connected to the server and kick any user directly from the admin panel.
  • Broadcast admin messages: Send official server announcements to all connected clients at once.
  • Connect to chat rooms: Join any active server by entering its IP, port, nickname, and password.
  • Chat in real time: Send and receive messages instantly in a clean chat interface with formatted time labels.
  • Run multiple instances: Quickly launch extra client or server windows directly from the top menu bar to test multi-user conversations on a single machine.

System Architecture & Communication Protocol

The application uses asynchronous TCP sockets (TcpListener, TcpClient, NetworkStream) paired with System.Text.Json for serialization.

┌──────────────────┐               TCP / JSON                ┌──────────────────┐
│   Client App     │ ────────────── Auth / JSON ───────────> │  Server Window   │
│  (MainWindow)    │ <────────── Messages / Events ───────── │     (Server)     │
└──────────────────┘                                         └──────────────────┘

JSON Event Message Types

  • authorization / authorizationOK — Handshake and authentication validation.
  • messageGot — Message broadcast packet carrying content and author details.
  • otherUserConnected / otherUserDisconnected — Presence notification events.
  • iKicked / otherUserKicked — User moderation notification events.
  • serverClosed — Server shutdown signal notifying active clients.

Requirements & Setup

Prerequisites

  • .NET 8.0 SDK or higher
  • Windows OS (WPF framework requirement)
  • Visual Studio 2022 / JetBrains Rider / VS Code (with C# extension)

Building and Running

  1. Clone the repository:

    git clone https://github.com/uasuna2022/GroupChat.git
    cd GroupChat
  2. Build the solution:

    dotnet build "Group Chat/Group Chat.sln"
  3. Run the application:

    dotnet run --project "Group Chat/Group Chat/Group Chat.csproj"

Testing Multi-User Chat Locally

  1. Start the application.
  2. Host a Server: Click New -> Add new server in the menu bar, enter server credentials (IP, Port, Admin Username, Password), and click Start.
  3. Connect Clients:
    • Click File -> Connect on the client window.
    • Enter the server IP, Port, Username, and Password to join.
    • Click New -> Add new user to open additional client windows and test multi-user messaging.

About

A real-time desktop multi-user chat application built with C#, .NET 8.0, and WPF using TCP sockets and a custom JSON messaging protocol.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages