本文整理汇总了Python中Packet.Packet.seq_number方法的典型用法代码示例。如果您正苦于以下问题:Python Packet.seq_number方法的具体用法?Python Packet.seq_number怎么用?Python Packet.seq_number使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet.Packet
的用法示例。
在下文中一共展示了Packet.seq_number方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send
# 需要导入模块: from Packet import Packet [as 别名]
# 或者: from Packet.Packet import seq_number [as 别名]
def send(self, flag, message):
#print ("\nTYPE = " + self.type)
self.send_buffer = message
if self.remote == None:
raise 'must call "bind()" first'
#client initializes connection
elif flag == None and self.type == "CLIENT" and self.STATE == "ESTABLISHED":
buffer = []
while len(message) > 0:
buffer.append(message[:self.window_size])
if len(message) < self.window_size:
message = ''
else:
message = message[self.window_size:len(message)]
for s in buffer:
pack = Packet(s, self.remote)
pack.flag = None
pack.seq_number = self.packet_number
top_data = pack.seq_number + pack.length
print ("-> data " + str(pack.seq_number) + " - " + str(top_data))
self.packet_number = top_data
self.cache[pack.seq_number + pack.length] = pack, self.current_time()
self.sched.add(self.current_time(), pack, self.send_data)