youll need to account for at least the following a

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: the keyboard; time to think, not write code. Now we come to the crux of this exercise, the design of a chat system. You should by now understand the capabilities of the server, which are a lot more useful for a chat system than our previous apache/php based server. We can accept connections 1 The ‘strip’ function removes any whitespace from the start and end of the message, and ‘partition’ then returns a tuple containing three elements: things before the partition character, things that match the partition character, and things that come after the partition character. Tuple ­assignment then puts these values in to command, sep, and message respectively (though we don’t care about the contents of ‘sep’, so we then just ignore this). There are plenty of other ways of achieving the same thing in Python, feel free to invent your own here if this one seems odd. from an arbitrary number of clients, and unlike the Lab 2 server, remember those connections exist. We can accept messages sent from those clients, and are free to decide what messages are meaningful or useful. This next task requires you to design a suitable set of messages that together form a protocol for your chat system. You can do this with pen and paper, or if you must, with a text editor – but don’t be tempted to try to implement these until you’re confident you have a sensible protocol (you might want to get this sanity ­checked by a demonstrator before you continue, it will only take a moment and could save you a lot of pain later on!) You’ll need to account for at least the following • A new user registering themselves with the server, and giving the server a ‘screen name’ that they want to use. • Some way of sending a message to everyone that’s connected to the server • Some way of sending a message to a specific user (this bit is ‘optional’ in the sense that you can get most of the marks without it.. but even if you don’t implement the private message options, you should take them into account in your protocol). Hint : remember to design your protocol so that it...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online