0

So I am making this game in pygame and I wanted to add multiplayer to it. I have never done this before so this is super confusing for me.

I watched some videos online and they all said basically the same thing for the server and the client. Basically I am trying to connect the client to the server but I am getting this error:

OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted, and it says that the problem is when I am binding the server and the port.

Here is some of my code:

server.py

    def __init__(self):
        self.port = 65536
        self.server = "192.168.1.180"
        self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.bind()
        #more irrelevant properties
    
    def bind(self):
            self.s.bind((self.server, self.port))
    
    def run(self):
        self.s.listen(4)
        print("Waiting for connection; Server started")
        
        while True:
            conn, addr = self.s.accept()
            print("Connected to: ", addr)
        self.s.close()

Again this is all very confusing for me so any help would be great.

0 Answers0