DOC PREVIEW
Berkeley ELENG 122 - Project 1A – Chat Client

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Project #1A – Chat Client Due Oct 22 @ 3:50 pm EE122: Introduction to Communication Networks (Fall 2008) Department of Electrical Engineering and Computer Sciences College of Engineering University of California, Berkeley Project Goal Create a Chat application consisting of a chat client and a chat server. The client and server must be written in C or C++ and must use sockets. Project Timeline Project 1 consists of two parts. 1. The first part (part A) is to implement the chat client. It is due on Oct. 6. We will provide you a server that can be reached at: IP 128.32.48.187, port 10000. You can use this server to test your client. In addition, we will provide you the binary for the server that you can execute on instructional UNIX machines. Your overarching goal for this part is to make your client work with our server! 2. The entire project is due on Oct. 20. It includes both the client and server code. The specification for the server will be provided soon. Section I: Introduction The chat application allows multiple chat clients to connect to a chat server. Connected clients can: list the members already logged in, log in with a username, exchange messages with other logged in users, and log out. The server has to accept and maintain connections to all the clients and relay chat messages between them. Section II: Chat Client Overview The chat client application has to do the following tasks: 1. Connect to a chat server. The client obtains the server IP address and the port it is listening on from command‐line arguments. For example: >./client 128.32.48.187 10000 Then, the client i mmediately attempts to connect to the server socket usi ng TCP. If it fails, the client application prints an error message to the console and returns. To print the error message, the client must call function perror (defined in stdio.h) with the name of the socket function that failed in lowercase. For example: perror(“socket”); If, on the other hand, the connection succeeds, the client continues to step 2. 2. Accept console text commands from the user. The client must be able to handle the following commands. Parameters are enclosed in <>: a. login <username> b. list c. sendto <username> <message> d. logout e. exit Each line must begin with a command. The parameters (if any) are separated by a space. The commands and parameters are described in more detail below. In order to implement these commands correctly, the client will have to send and receive the following messages to/from the server: a. Send messages to the server. The client must be able to send the following messages to the server. These messages are described in detail in section 4 of the document: i. Login Message ii. List Message iii. Sendto Message iv. Logout Message b. Accept incoming messages from the server. The client must be able to properly react to the following messages. These messages are shown in section 5 of the document: i. List Message ii. Response Message iii. Sendto Message Section III: Console Commands We now present the console commands that a client must handle. Note: whenever a client prints an error message, it should not perform any other action. • login: sends a login message to register with the server using the provided username. o Parameter(s): a string to be used as the username. o Rules:  The string may not contain any white space. Screen names are treated as case sensitive.  Any extra parameters after the username must cause the client to print an error. The error must also be printed if the username is more than 20 characters in length or if the username is not present. The following is the er ror: Bad username o Examples:  The following is an example of a valid command: login John  The following is an example of an invalid command: login John Doe • list: sends a list message requesting the list of users already logged in. o Parameter(s): none o Rules:  Any extra parameters must cause the client to print the following error: Invalid command o Examples:  The following is an example of a valid command: list  The following is an example of an invalid command: list bob • sendto: sends a sendto message to the server to communicate with another client. o Parameters: The user nam e of the destination client and the text to send. o Rules:  If either or both of the parameters are missing or if the username contains more than 20 characters, the following error message should be printed to the console: Bad username  If there are more than 65535 characters of text, the following error message should be printed to the console: Bad message o Examples:  The following is an example of a valid command: sendto John Hello, how are you?  The following is an example of an invalid command: sendto JohnHello • logout: sends a logout message to the server. o Parameters: none. o Rules:  Any extra parameters must cause the client to print the error: Invalid command  The client should not close the connection with the server when executing this command. After executing this command, the client should still be able to execute the list and login commands. o Examples:  The following is an example of a valid command: logout  The following is an example of an invalid command: logout Joe • exit: closes the client socket and exits the program. o Parameters: Takes no parameters o Rules:  Any extra parameters must cause the client to print the error: Invalid command o Examples:  The following is an example of a valid command: exit  The following is an example of an invalid command exit client Protocol Overview: For each message that the client sends to the server the server will send a message back. For a successful Li st Message the server will return a List Message back (see the messages specification for details). For all other messages or an unsuccessful List Message, the server will respond with a Response Message. The client never sends messages back in response to messages received from the server. Section IV: Messages Sent from Client to Server The following is the structure for messages the client sends to the server. In all of these diagrams, B is a shortcut for Byte and XB refers to a


View Full Document

Berkeley ELENG 122 - Project 1A – Chat Client

Documents in this Course
Lecture 6

Lecture 6

22 pages

Wireless

Wireless

16 pages

Links

Links

21 pages

Ethernet

Ethernet

10 pages

routing

routing

11 pages

Links

Links

7 pages

Switches

Switches

30 pages

Multicast

Multicast

36 pages

Switches

Switches

18 pages

Security

Security

16 pages

Switches

Switches

18 pages

Lecture 1

Lecture 1

56 pages

OPNET

OPNET

5 pages

Lecture 4

Lecture 4

16 pages

Ethernet

Ethernet

65 pages

Models

Models

30 pages

TCP

TCP

16 pages

Wireless

Wireless

48 pages

Load more
Download Project 1A – Chat Client
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Project 1A – Chat Client and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Project 1A – Chat Client 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?