示例#1
0
	def sendingDATA(self, pack):
		packet4Bytes = pack.__serialize__()
		self.transport.write(packet4Bytes)
		print("ClientData Packet Sent")
		timer = Timer(Seconds(2),self.sendingDATA,pack)
		self.timers.append(timer)
		timer.start()
示例#2
0
	def shutdown(self):
		if len(self.packets) == 0:
			self.sendRIP()
		else:
			print(len(self.packets))
			t = Timer(Seconds(2),self.shutdown)
			t.start()
示例#3
0
	def sendRIPACK(self):
		pack = PEEPPacket()
		pack.Type = 4
		pack.SequenceNumber = 0
		pack.Acknowledgement = 0
		pack.Checksum = self.calculateChecksum(pack)
		packet4Bytes = pack.__serialize__()
		self.transport.write(packet4Bytes)
		print("RIP Packet Sent")
		rip_timer = Timer(Seconds(2),self.abort_connection)
		rip_timer.start()
示例#4
0
	def shutdown(self):
		if len(self.packets) == 0:
			self.sendRIP()
		else:
			timer = Timer(Seconds(2),self.shutdown)
			timer.start()