1 Star 0 Fork 0

AUST_RM_HongLie/RoboHero-server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
socket_setting.py 698 Bytes
一键复制 编辑 原始数据 按行查看 历史
mamawhes 提交于 2023-11-01 00:53 . 并发完成
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/aust_-rm_-hong-lie/RoboHero-server.git
git@gitee.com:aust_-rm_-hong-lie/RoboHero-server.git
aust_-rm_-hong-lie
RoboHero-server
RoboHero-server
main

搜索帮助