这是我的代码:
user_input = input("What port would you like to use? ")
def output(name):
print(f'Set Port {name}')
output(user_input)
Hello123 = input(f'Please Choose A IP Address ')
if Hello123 == '127.0.0.1':
print('WARNING PLEASE BE SURE YOU KNOW WHAT YOUR DOING BEFORE YOU SET THIS')
def output(ipaddr):
print(f'Set Ip {ipaddr}')
output(Hello123)
HOST = (f'{ipaddr}')
PORT = (f'{name}')
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_socket.bind((HOST, PORT))`
我正在 python 中创建一个套接字,我希望它是 {HOST} 的 ipaddr 和用户输入我也想对 PORT 和 {name} 执行相同的操作
慕森王
相关分类