本文整理汇总了Python中PyDatagram.PyDatagram.addServerControlHeader方法的典型用法代码示例。如果您正苦于以下问题:Python PyDatagram.addServerControlHeader方法的具体用法?Python PyDatagram.addServerControlHeader怎么用?Python PyDatagram.addServerControlHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyDatagram.PyDatagram
的用法示例。
在下文中一共展示了PyDatagram.addServerControlHeader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: clearPostRemove
# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerControlHeader [as 别名]
def clearPostRemove(self):
"""
Clear all datagrams registered with addPostRemove.
This is useful if the Panda3D process is performing a clean exit. It may
clear the "emergency clean-up" post-remove messages and perform a normal
exit-time clean-up instead, depending on the specific design of the game.
"""
dg = PyDatagram()
dg.addServerControlHeader(CONTROL_CLEAR_POST_REMOVE)
self.send(dg)
示例2: addPostRemove
# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerControlHeader [as 别名]
def addPostRemove(self, dg):
"""
Register a datagram with the Message Director that gets sent out if the
connection is ever lost.
This is useful for registering cleanup messages: If the Panda3D process
ever crashes unexpectedly, the Message Director will detect the socket
close and automatically process any post-remove datagrams.
"""
dg2 = PyDatagram()
dg2.addServerControlHeader(CONTROL_ADD_POST_REMOVE)
dg2.addString(dg.getMessage())
self.send(dg2)
示例3: unregisterForChannel
# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerControlHeader [as 别名]
def unregisterForChannel(self, channel):
"""
Unregister a channel subscription on the Message Director. The Message
Director will cease to relay messages to this AIR sent on the channel.
"""
if channel not in self._registeredChannels:
return
self._registeredChannels.remove(channel)
dg = PyDatagram()
dg.addServerControlHeader(CONTROL_REMOVE_CHANNEL)
dg.addChannel(channel)
self.send(dg)
示例4: registerForChannel
# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerControlHeader [as 别名]
def registerForChannel(self, channel):
"""
Register for messages on a specific Message Director channel.
If the channel is already open by this AIR, nothing will happen.
"""
if channel in self._registeredChannels:
return
self._registeredChannels.add(channel)
dg = PyDatagram()
dg.addServerControlHeader(CONTROL_ADD_CHANNEL)
dg.addChannel(channel)
self.send(dg)