def start(self):
"""
Run the aDTN network functionality in two threads, one for sending and the other for receiving. Received
Ethernet frames are filtered for ethertype and processed if they match the 0xcafe type. The sending thread runs
a scheduler for periodic sending of aDTN packets.
"""
self._start_time = time()
self._sent_pkt_counter = 0
self._received_pkt_counter = 0
self._decrypted_pkt_counter = 0
self._prepare_sending_pool()
self._scheduler.enter(self._sending_freq, 1, self._send)
self._sniffing = True
self._thread_receive = Thread(target=self._sniff, name="ReceivingThread")
self._sending = True
self._thread_send = Thread(target=self._scheduler.run, name="SendingThread", kwargs={"blocking": True})
log_network("start-{}-{}".format(self._batch_size, self._sending_freq))
self._thread_receive.start()
sleep(5)
self._thread_send.start()
评论列表
文章目录