Design and Implementation of Chat Server Client Program

Verified

Added on  2019/09/23

|3
|435
|158
Project
AI Summary
This assignment focuses on designing a chat server client program. The program is required to communicate with a chat server, receive messages, and display the conversation. The program must handle user input, specifically keyboard characters, backspace, and enter, to allow users to send messages to the server and edit the text field. The assignment also specifies how to block specific users. The program should display the last five received messages. The grading will be based on the design of the handler, even if the program is incomplete. The program must track the text the user edits and the conversation received from the server. The assignment also provides hints and suggestions on implementation and representation of the conversation.
Document Page
Graded Exercise
Exercise 3 Design the world program client. The
program communicates with achat server and displays the
conversation in this chat room.
The program must be prepared to receive messages from
the server. All messages from the server are plain strings.
When such a string arrives, it is added as the most recent
element to the conversation.
The program also interacts with the user, who may edit one-
line text fields:
Its key handler accepts keyboard characters of length 1
—except for "\r"(enter) and "\b" (del)—and adds
them to the end of the text.
When the user presses the so-called backspace (or
delete) key, the program must erase the last 1String
that was added (if any).
When the user presses enter aka return ("\r"), the
program sends the current string in the text field to the
server and clears the text field.
Feel free to equip your program with additional edit
capabilities. Also, your program may display its state in any
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
way you like; the only constraint is that the canvas should
contain the last five received messages (at least).
Hints This choice of representation violates the model-
view design principle espoused on the preface. No
worries, you will be able to improve on this solution soon.
(1) Clearly the program must track two different pieces of
information: the text that the user edits and the
conversation itself, that is, the texts that the program has
received. (2) The simplest editor representation is a string;
consider alternatives. (3) Represent the conversation with
an image. (4) See the notes on Client Programs.
Note The messages from the server have the shape
"name: content"
For example, "ben: hello" and "alan+nada: world" are
legitimate messages.
You can block a user if you dislike her messages or the way
he spells his name and so on. Simply type in the text
"-name"
and name will no longer be able to send you messages. For
example, the text message "-ben" will block Ben from
sending you messages.
Document Page
Grading We will grade the design of each handler
separately. So turn in your program even if it remains
incomplete and cannot connect to the chat server.
chevron_up_icon
1 out of 3
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]