I want to write a python code so that the client will send requests to the server to reverse strings (taken as a command line input) over the network using sockets. This assignment uses a two-stage communication process. First, in the negotiation stage, the client and the server negotiate through a fixed negotiation port (<n_port>) of the server, a random port (<r_port>) for later use. Then, later in the transaction stage, the client connects to the server through the negotiated random port (<r_port>) for actual data transfer. When I executed the server code on the Ubuntu server, it worked fine. But when I ran the client code, it gave me "SyntaxError: Non-ASCII character '\xe2' in file TCPClt.py on line 2, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details". Would you please check what is wrong with the Client code and review the whole code so that to perform the job? Here is the code
TCP Server
import socket
serverPort = 9023
serverSocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
serverSocket.bind(('',serverPort))
serverSocket.listen(1)
print("Ther server is ready to receive the connection...")
while True:
connectionSocket, addr = serverSocket.accept()
sentence = connectionSocket.recv(1024).decode()
ReverseSentence = sentence[::-1]
connectionSocket.send(ReverseSentence.encode())
connectionSocket.close()
TCP CLient
from socket import *
serverName = ’ubuntu2004-002.student.cs.university.ca’
serverPort = 9023
clientSocket = socket(AF_INET, SOCK_STREAM)
clientSocket.connect((serverName,serverPort))
sentence = raw_input(‘Input lowercase sentence:’)
clientSocket.send(sentence.encode())
modifiedSentence = clientSocket.recv(1024)
print modifiedMessage.decode()
clientSocket.close()