[SOLVED] 代写 socket network 2019/5/17 Mini-project 3: TCP Chat Client

30 $

File Name: 代写_socket_network_2019/5/17_Mini-project_3:_TCP_Chat_Client.zip
File Size: 593.46 KB

SKU: 4016164241 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


2019/5/17 Mini-project 3: TCP Chat Client
Mini-project 3: TCP Chat Client
Due No Due Date Points 40
Overview
This mini project exercises your TCP network programming skills to implement the client side protocols for a chat room. This TCP chat room contains three components (not because it’s the best way to do it, but because it’s relatively easy to keep the code separated this way).
Component 1, which you do not need to implement (yet), is the chat server. This server handles messages from the other two components, and send messages as well as managing the clients that are connected. It is a simple server; it takes chat messages sent from component 3 (the chat client) and sends them along to each chat monitor (component 2) that is currently registered with the server.
Component 2, which you do need to implement if you want credit (based on the skeleton in tcp_chat_monitor.cpp) is the chat monitor. This program registers itself with the chat server, and then receives messages from the server, where each server-to-monitor message contains a message sent from a client (component 3).
Component 3, which you do need to implement (based on the skeleton in tcp_chat_client.cpp) is the chat client. This program registers itself with the chat server, gives itself a nickname (which the server remembers), and then takes messages input on stdin and sends them to the server.
What do I need to do?
The message headers are given in tcp_chat.h . Using these you will implement the client and monitor programs. Your code must use either select or poll, in order to get input from both stdin (fd 0) or from the server socket(s).
For component 2:
1. Your monitor needs to “connect” to the server as with the client, but this time with a ChatMonMsg, with type MON_CONNECT.
2. The monitor will then read messages from the server, which are sent as a ChatMonMsg with type MON_MESSAGE, where the
nickname_len and data_len fields are set to the length of the nickname and message, appended after the ChatMonMsg in the UDP datagram. The monitor needs to verify the sizes are correct (the bytes received must be equal to the size of the ChatMonMsg + nickname_len + data_len, right?). Then the monitor will parse out the nickname and message from the TCP datagram and print it out to the console.
3. Once the monitor is shut down (using a Ctrl+C signal handler), the monitor will send a final ChatMonMsg, with type MON_DISCONNECT.
For component 3:
1. Your client needs to “connect” to the server, by sending a ChatClientMessage with type CLIENT_CONNECT (in network byte order!) to the server. The server will not send a response.
2. The client then needs to tell the server what nickname to use for the client. To do this you will send a ChatClientMessage with type CLIENT_SET_NICKNAME (network byte order…) along with the nickname directly after the ChatClientMessage. Additionally, the data_length of the ChatClientMessage should indicate the length of the nickname (without a null terminator (again in network byte order (nbo))!)
3. The client will then read messages from stdin, and send them to the server as for the nickname message, but with type CLIENT_SEND_MESSAGE, data_length equal to the length of the message (no null terminator), and the message appended after the ChatClientMessage.
4. Your client should also support sending direct messages to other members of the chat. This is indicated by typing a “/” followed by the username you want to send the message to, followed by the message (for example “/nate hello”) would send the message “hello” to any users with the nickname “nate”.
1. To send a direct message, it is similar to sending a normal message, except it is of type CLIENT_SEND_DIRECT_MESSAGE.
2. A direct message necessarily must also include the nickname (so must include the length of the nickname as well as the nickname
appended to the end of the message).
5. Once the user types ‘quit’, the client will finally send a ChatClientMessage with type CLIENT_DISCONNECT and no data.
Header File
tcp_chat.h
How do I test my stuff????
https://canvas.du.edu/courses/78542/assignments/585615
Course Chat 1/2

2019/5/17 Mini-project 3: TCP Chat Client
Course Chat
There is a server implementation running at IP address 130.253.XX.YY on port ZZZZ. This server should be running until the assignment is due, though it may be stopped and restarted periodically. To test, it is recommended you first start the chat monitor (so you can see what
you send), then start the client (in a separate terminal) and verify the monitor receives the messages you send.
Example:
Start the monitor.
3 people online 
New message alerts
./tcpchatmon 130.253.8.15 9999 nate
Then start the client, enter your nickname, and send a message.
./tcpchatcli 130.253.8.15 9999
Enter chat nickname: Nate
Enter chat message to send, or quit to quit: Hello there!
Sending message Hello there!
In the monitor, you should see that you’ve connected, and your message was received.
SERVER said: Nate JOINED the chat.
Nate said: Hello there!
And that’s it. Note the names of the binaries (tcpchatmon, tcpchatcli).
How will it be graded?
Heartlessly, as per usual. To test your implementation, we (the computer(s)) will run the server on some IP:PORT, and then start the monitor, start the client, send messages, quit, and check if the client and monitor output match what they should. We will also verify whether the connect/disconnect message are sent properly. Note that the server may also send garbage (unexpected types, ridiculous length messages, etc.) to test your code’s handling of such things, because you can never trust what’s coming in on your sockets!
How to submit?
You will create a directory in the root of your git repository called “TCP_mini_proj1”. In this directory there must be a makefile which builds the two components (tcpchatcli and tcpchatmon). This should be straightforward since you have the makefile. Test your code and makefile on linux, preferably on linux.cs.du.edu to make sure it builds and runs properly.
Send
https://canvas.du.edu/courses/78542/assignments/585615
Course Chat 2/2

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 socket network 2019/5/17 Mini-project 3: TCP Chat Client
30 $