0

I am trying to write a code in python so that a client will send requests to the server to reverse strings (taken as a command line input) over the network using sockets. I tried to execute the below Server code and it gave me [Errno 48] Address already in use. I`d appreciate helping me to solve this error.

Here is the code:

import socket
serverPort = 12000
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()
Wess
  • 31
  • 1

0 Answers0