mirror of
https://github.com/CraftyBoss/SuperMarioOdysseyOnline.git
synced 2024-11-22 03:05:16 +00:00
tcpServer: Support specifying port number
This commit is contained in:
parent
740f562906
commit
a416458e73
1 changed files with 6 additions and 1 deletions
|
@ -6,8 +6,12 @@ import sys
|
|||
# Create a TCP/IP socket
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
||||
port = 3080
|
||||
if len(sys.argv) == 3:
|
||||
port = int(sys.argv[2])
|
||||
|
||||
# Bind the socket to the port
|
||||
server_address = (sys.argv[1], 3080)
|
||||
server_address = (sys.argv[1], port)
|
||||
print(f"Starting TCP Server with IP {server_address[0]} and Port {server_address[1]}.")
|
||||
sock.bind(server_address)
|
||||
|
||||
|
@ -35,3 +39,4 @@ while True:
|
|||
finally:
|
||||
# Clean up the connection
|
||||
connection.close()
|
||||
|
||||
|
|
Loading…
Reference in a new issue