代码拉取完成,页面将自动刷新
import socket
class Struct_Socket:
address:str
port:int
max_player_number:int
def __init__(self,address="127.0.0.1",
port=25565,
max_player_number=5
) -> None:
self.address=address
self.port=port
self.max_player_number=max_player_number
def socket_init(struct_Socket:Struct_Socket) -> socket.socket:
#tcp协议
mysocket=socket.socket(type=socket.SOCK_STREAM)
#绑定ip、端口
mysocket.bind((struct_Socket.address,struct_Socket.port))
# 监听客户端的连接请求
mysocket.listen(struct_Socket.max_player_number)
mysocket.settimeout(1)
return mysocket
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。