本文整理汇总了Python中Packet.Packet.initialise方法的典型用法代码示例。如果您正苦于以下问题:Python Packet.initialise方法的具体用法?Python Packet.initialise怎么用?Python Packet.initialise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet.Packet
的用法示例。
在下文中一共展示了Packet.initialise方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createAndSendPacket
# 需要导入模块: from Packet import Packet [as 别名]
# 或者: from Packet.Packet import initialise [as 别名]
def createAndSendPacket(destinationId,ttl,msgType,timestamp,payload):
p = Packet()
p.initialise(0,destinationId,ttl,msgType,timestamp,payload)
print "Creating and Sending: "
print p
global sendingSocket
sendingSocket.sendData(p.getBytes())
示例2: create_and_send_packet
# 需要导入模块: from Packet import Packet [as 别名]
# 或者: from Packet.Packet import initialise [as 别名]
def create_and_send_packet(destinationId,ttl,msgType,timestamp,payload):
global mesh_sending_socket
p = Packet()
p.initialise(0,destinationId,ttl,msgType,timestamp,payload)
print "Creating and Sending: " + str(p)
try:
mesh_sending_socket.sendData(p.getBytes())
print "sent"
except:
print "A connection error happened. Are you simulating the mesh?"
示例3: getInput
# 需要导入模块: from Packet import Packet [as 别名]
# 或者: from Packet.Packet import initialise [as 别名]
def getInput():
while True:
print "Enter old ID: "
oldId = sys.stdin.readline()
print "Enter new ID: "
newId = sys.stdin.readline()
'''if(data == 'quit'):
break
if(data == ''):
continue
'''
payload = PayloadIdentification()
payload.initialise(int(oldId),int(newId))
p = Packet()
p.initialise(0,0xFF,1,0,0,payload)
print p
global socketConnection
socketConnection.sendData(p.getBytes())