Exercise: Chat application

In this exercise you must program a chat server + a chat client.

Transport protocols must be TCP.

Client program must have simple (ugly??) have a graphical user interface. Use WPF, not Windows Store App, since many network related API's can not be used from Windows Store Apps.

One chat server can be used by multiple clients. The clients sends messages to the server - and the server sends each message to all the clients.

Getting ready

Before you start progamming, you probably have to make a few sketches using pen and paper: Try to sketch the communication between the client(s) and the server.


The easiest design is probably to have long TCP connections:

  1. Client make a connections
  2. Server stores the connection in some datastructure (List, Dictionary, or ...)
  3. Server make a Task to service this client
  4. The connections is not when the client leaves the chat (long connection)

Extra: Chat groups/rooms

Messages are not send to all clients, but only to client who are members of a specific group/room.

Extra: IRC protocol

One popular chat protocol is IRC (Internet Relay Protocol): RFC 1459, May 1993 (newer versions do exist)

Investigate this protocol and let it inspire you in defining your own chat application.

Extra: Short TCP connections

Try to redesign the chat to use short TCP connections like Echo and HTTP/1.0.

Extra: UDP

Try to make an UDP version of the chat ...

Extra: Shared white board

In this version you can make a simple drawing and all other clients see the drawing ...