- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
Latest commit
19 lines (12 loc) · 469 Bytes
/
Copy pathserver.py
File metadata and controls
19 lines (12 loc) · 469 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
fromGameimportGame
importsocket
game=Game()
s=socket.socket() # Create a socket object
host=socket.gethostname() # Get local machine name
port=12345# Reserve a port for your service.
s.bind((host, port)) # Bind to the port
s.listen(1) # Now wait for client connection.
c, addr=s.accept() # Establish connection with client.
print('Got connection from', addr)
game.set_socket(s, c)
game.play()