PYTHON CHAT SERVER PLEASE HELP can someone help me alter the following python co
ID: 3730717 • Letter: P
Question
PYTHON CHAT SERVER PLEASE HELP
can someone help me alter the following python code below, its for a chat server in python and im supposed be able to run a list of /commands
as you can see in the code I alread have the commands /help /join /quit and /list which do the following
HELP Syntax: HELP
Requests the server to display the help file. This command is not formally defined in an RFC, but is in use by most major IRC daemons.
JOIN Syntax: JOIN []
Makes the client join the channels in the comma-separated list , specifying the passwords, if needed, in the comma-separated list .If the channel(s) do not exist then they will be created. Defined in RFC 1459.
LIST Syntax: LIST [ []]
Lists all channels on the server.[15] If the comma-separated list is given, it will return the channel topics. If is given, the command will be forwarded to for evaluation. Defined in RFC 1459.
QUIT Syntax: QUIT []
Disconnects the user from the server.[32] Defined in RFC 1459.
All of which work perfectly but the problem im having is trying to add a few more commands, can someone help me add the following commands
CONNECT
DIE
The definitions of the commands can be found below
CONNECT Syntax: CONNECT [ []] (RFC 1459)
CONNECT [] (RFC 2812)
Instructs the server (or the current server, if is omitted) to connect to on port .This command should only be available to IRC operators. Defined in RFC 1459; the parameter became mandatory in RFC 2812.
DIE Syntax: DIE
Instructs the server to shut down.This command may only be issued by IRC server operators. Defined in RFC 2812.
please help
--------------------------------------------------------------------------------
ChatServer.py
-----------------------------------------------------------------------------------
Explanation / Answer
CONNECT:
Connect server and send a message to client
def connect(self,clientSocket):
self.serverSocket.connect(self.address)
clientSocket.sendalll(" > Server Connection established ".encode('utf8'))
For DIE command since you have already implemented server_shutdown() function, just call the function from "def die():"
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.