问题描述
我正在连接到多播服务器(在我自己的计算机上)以接收一些流数据。我声明:
# Change this value to the IP address of the NatNet server.
self.serverIPAddress = "127.0.0.1"
# Change this value to the IP address of your local network interface
self.localIPAddress = "127.0.0.1"
# This should match the multicast address listed in Motive's streaming settings.
self.multicastAddress = "127.0.0.1"
# Create a data socket to attach to the NatNet stream
def __createDataSocket( self,port ):
result = socket.socket( socket.AF_INET,# Internet
socket.soCK_DGRAM,socket.IPPROTO_UDP) # UDP
result.setsockopt(socket.soL_SOCKET,socket.so_REUSEADDR,1)
result.setsockopt(socket.IPPROTO_IP,socket.IP_ADD_MEMBERSHIP,socket.inet_aton(self.multicastAddress) + socket.inet_aton(self.localIPAddress))
result.bind( (self.localIPAddress,port) )
return result
但要排队
result.setsockopt(socket.IPPROTO_IP,socket.inet_aton(self.multicastAddress) + socket.inet_aton(self.localIPAddress))
我不断收到错误消息:
OSError: [WinError 10049] The requested address is not valid in its context
我不明白为什么在使用本地主机(127.0.0.1)时会发生这种情况,有人可以解释吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)