Project Information
- Language: C#
- Framework: .NET 4.7.2
- Creation: Y2 S1
- Source URL: GitHub Page
Online Applications
Created as part of my Concurrent Network Applications module in the first semester of my second year. The first task was to create a multithreaded chat application, using C# and the .NET framework, which would utilize socket programming and a client-server architecture which would allow for multiple clients to send and receive messages across the local network. The second task was to create a graphical application that would use the same architecture, but with the focus now on the synchronization of graphics across the local network.
How the Applications were Developed
For both applications, a client-server architecture was utilized alongside a packet system, which would allow for both the clients and the server to send and receive packets of data. The TCP/IP protocol was used to make the initial connection between each client and the server, along with the sending of messages. UDP was used specifically for drawing on the canvas in the paint application since lost packets would not have had a noticeable impact on the graphics, and it has the added benefit that it is faster than TCP/IP which is an advantage in the synchronization of graphics.
Additional Features
Across both applications, several features were implemented, which the most essential being cryptography. This was added to both applications to protect the data between transmission of the clients and server. The synchronization of public and private keys for the encryption and decryption of data were required on both the client and server.
// encrypt data using the server's public key private byte[] Encrypt( byte[] data ) { lock( RSAProvider ) { RSAProvider.ImportParameters( ServerKey ); return RSAProvider.Encrypt( data, true ); } } // decrypt data using client's private key private byte[] Decrypt( byte[] data ) { lock( RSAProvider ) { RSAProvider.ImportParameters( PrivateKey ); return RSAProvider.Decrypt( data, true ); } }Exclusive to the messaging system, a friends list was added with the option of sending private messages to a select friend. This required some work on the packet system to fully implement but can be seen from the provided video. A muting system was also added which would block messages from a specified client, or block the receiving of messages across all connected clients from a specified client which was a feature reserved for the administrator.
Both applications also have the added feature of spawning more clients from the administrator instance. This allowed for the simple debugging of clients and helped to ensure that the server would not get overloaded when a large number of clients were connected and all sending messages.