0

I'm creating a simple server to receive message from outside network When I run the following code in raspberry:

s = socket(AF_INET, SOCK_STREAM)
s.bind((Host, Port)) 
s.listen(5)
print ("Server is running\n")
c, a = s.accept()
print (addr, " is now connected! \n") 
data = recieveData(s, c, a)

after running like 10 seconds, the server is terminated with error:

Traceback (most recent call last):
socket.error: [Errno 98] Address already in use

I don't recall stop the server ungracefully by pressing Ctrl C, and even that I did, I've waited for the server to release it, or even using ps -fA | grep python and kill the running processes, but none of these works. It still has the error? I cannot change the port as it's the required port for the program. Does anyone having any idea how to fix it? I'd be really appreciated.

shjnlee
  • 221
  • 2
  • 6
  • 20

0 Answers0