Drawing all over the network

Over the past three weeks in Studio 3 we have been working on a collaborative art project.  This facilitated us to learn how to implement a UDP socket client to communicate with a supplied server application.  The server application came with information on the packets it accepts and is a canvas for our clients to draw all over.  The client we were tasked with implementing could be developed in any language we wish and the functionality was split into two phases.

The first phase covers sending data to the server while the second is receiving data – preferably in a non-blocking way.  The first client I wrote was a C# WinForms application that sent packets to the server.  It was a quick and dirty prototype but it allowed me to figure out the limitations of the server – such as sending a Box packet that didn’t use a Top Left origin would crash the server.

C# Draw Client

Since I wanted to focus mainly on C++ this trimester, I decided to port the client to C++/SFML.  Future functionality was only implemented into the C++ client which included broadcasting to announce that the client was looking for a server, receiving the response from the announce, sending and receiving cursor information in a non-blocking way and building a heat map of the user’s activity.

draw_client

The above image consists of the draw server on the left, followed by the heat map of user activity and on the right is the draw client with other users’ cursor information.

Overall the experience of writing a network client has been refreshing as I haven’t done much networking stuff in years.

Leave a Reply

Your email address will not be published. Required fields are marked *