Python代写|Assignment 3 – Chat Server
AUTHOR
essaygo
PUBLISHED ON:
2021年12月20日
PUBLISHED IN:

本次澳洲代写是一个Python 聊天服务器开发的assignment

You are tasked with creating a chat server that will serve multiple clients and
hold multiple channels.

The server will receive messages sent from clients and relay the messages to
other clients.

Server

Your server needs to acquire information for itself. It needs to know what port it
is listening to, which database it is reading from and manages a large number of
concurrent connections. The server should try to utilise non-blocking IO and/or
processes to allow for asynchronous communication. Consider using the select
module and/or multiple processes for the server.

Any implementation that can only serve one client at a time will not be accepted.
Your server will be lauched in the following way.

python server.py <port> [configuration]

Protocol

You need to implement the following protocol on the server. A message protocol
is a set of agreed procedures between parties. In this case, these protocols specify
the different type of messages that will be communicated between the client and
the server.

The client and server are aware of the types of messages they can send to and
receive from each other. Any messages that lie outside of the specified protocols
can safely be ignored.

Message Format

The message format is string in UTF-8 encoding. This character set supports
languages other than English, e.g. CJK characters, which can also be sent as
valid messages and usernames. However, protocol commands such as CON
NECT and REGISTER are required to exist in their specified form.

Messages

• LOGIN :USERNAME :PASSWORD

Your server will receive this message upon connection from a client. Your server
will process the username and password by checking if the user exists and the
password matches.

• REGISTER :USERNAME :PASSWORD

The client will be able to send the REGISTER message to register their own
username and password. The server will hold the username and password in a
database. The password should be hashed and not stored in plain text.
Since this is only version 0.1 of our protocol, we will only communicate using
plain text sockets.

• JOIN :CHANNEL

The JOIN message is sent to the server to indicate a channel that a user would
like to join. If the channel exists, the user is able to join the channel and be able
to send messages to others in that channel. If the channel does not exist or the
user attempt to re-join a joined channel, the user will receive a reply indicating
the error.

• CREATE :CHANNEL

A user is able to create a channel with a given name. If the channel already
exists, the channel will not be created and the user will receive a reply indicating
the error.

• SAY :CHANNEL :MESSAGE

This allows the user to send a message to a channel. Assume the user has joined
the channel, the server will receive this message and send it to the other users
in the same channel. If the user has not jointed the channel, then the user will
receive a reply indicating the error.

Once a user sends a SAY message, the user should receive a RECV of that message.

• RECV :USER :CHANNEL :MESSAGE

The client will receive this message, this occurs when a user sends a message
to the server via SAY, the server will send a RECV message detailing the user
who sent it, channel it was sent to and the message that was sent.

• CHANNELS

This command does not require the client to be logged in. It returns a list of
all the channels.

• RESULT :TYPE :MSG [:MORE. . . ]

This is a generic response from the server to the client. The result can contain
different types such as:

• JOIN
• CREATE
• LOGIN
• REGISTER
• CHANNELS

Each type will have a message or more to confirm if the message was successful
or invalid. Given the different types, this will impact the message(s) that can
be sent.

You may also like:
2022年11月25日 作业代写
作业代写|extra credit problem
2022年11月22日 作业代写
经济代写|Economic Analytics
扫描二维码或者
添加微信skygpa