mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-10 01:05:42 +00:00
test
This commit is contained in:
commit
e4a7cd3373
1 changed files with 16 additions and 12 deletions
|
@ -888,9 +888,7 @@ class pyPlcHomeplug():
|
|||
def showStatus(self, s, selection=""):
|
||||
self.callbackShowStatus(s, selection)
|
||||
|
||||
def mainfunction(self):
|
||||
# print("will evaluate self.sniffer")
|
||||
for ts, pkt in self.sniffer: # attention: for using this in non-blocking manner, we need the patch described above.
|
||||
def receiveCallback(self, timestamp, pkt, *args):
|
||||
self.nPacketsReceived+=1
|
||||
# print('%d' % (ts)) # the time stamp
|
||||
# We received an ethernet package. Determine its type, and dispatch it to the related handler.
|
||||
|
@ -901,6 +899,12 @@ class pyPlcHomeplug():
|
|||
if (etherType == 0x86dd): # it is an IPv6 frame
|
||||
self.ipv6.evaluateReceivedPacket(pkt)
|
||||
|
||||
def mainfunction(self):
|
||||
# https://stackoverflow.com/questions/31305712/how-do-i-make-libpcap-pcap-loop-non-blocking
|
||||
# Tell the sniffer to give max 100 received packets to the callback function:
|
||||
self.sniffer.dispatch(100, self.receiveCallback, None)
|
||||
|
||||
|
||||
self.showStatus("nPacketsReceived=" + str(self.nPacketsReceived))
|
||||
self.runPevSequencer() # run the message sequencer for the PEV side
|
||||
|
||||
|
|
Loading…
Reference in a new issue