当前位置: 首页>>代码示例>>Python>>正文


Python Packet.getBytes方法代码示例

本文整理汇总了Python中Packet.Packet.getBytes方法的典型用法代码示例。如果您正苦于以下问题:Python Packet.getBytes方法的具体用法?Python Packet.getBytes怎么用?Python Packet.getBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Packet.Packet的用法示例。


在下文中一共展示了Packet.getBytes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createAndSendPacket

# 需要导入模块: from Packet import Packet [as 别名]
# 或者: from Packet.Packet import getBytes [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())
开发者ID:SLIPD,项目名称:Basestation,代码行数:9,代码来源:cap.py

示例2: create_and_send_packet

# 需要导入模块: from Packet import Packet [as 别名]
# 或者: from Packet.Packet import getBytes [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?"
开发者ID:SLIPD,项目名称:Basestation,代码行数:12,代码来源:steveping.py

示例3: getInput

# 需要导入模块: from Packet import Packet [as 别名]
# 或者: from Packet.Packet import getBytes [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())
开发者ID:SLIPD,项目名称:Basestation,代码行数:20,代码来源:input.py

示例4: Packet

# 需要导入模块: from Packet import Packet [as 别名]
# 或者: from Packet.Packet import getBytes [as 别名]
from Packet import Packet
from payload import *

p = Packet("\xff\x00\x01\x00\xff\xff\xde\xe9\x91\x4f\x01\xb5\x8a\x20\xff\x00\xff\x00\x70\x27\x00\x00\xde\xe9\x07\x27\x00\x00\x8a\x20\xff\x00")
print p
print p.getBytes().encode('hex_codec')
开发者ID:SLIPD,项目名称:Basestation,代码行数:8,代码来源:packettest.py


注:本文中的Packet.Packet.getBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。