AttributeError:“Server”对象没有属性“setsockopt”

2024-06-02 14:07:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用Python制作一个多人游戏,并使用PodSixNet。但如果我运行服务器,它会显示:

AttributeError: 'Server' object has no attribute 'setsockopt'

下面是PodSixNet代码:

^{pr2}$

这是我的服务器代码:

import PodSixNet.Channel
import PodSixNet.Server
from time import sleep
class ClientChannel(PodSixNet.Channel.Channel):
    def Network(self, data):
        print (data)

class Server(PodSixNet.Server.Server):

    channelClass = ClientChannel

    def Connected(self, channel, addr):
        print ("new connection:", channel)

print ("STARTING SERVER ON LOCALHOST")
gameServer=Server()
while True:
    gameServer.Pump()
    sleep(0.01)

我真的很困惑,因为我是python的初学者。 谢谢你的帮助


Tags: 代码importself服务器dataserverdefchannel