MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _pollForNetBIOSPacket

Method _pollForNetBIOSPacket

pager_lib/nmb/NetBIOS.py:89–114  ·  view source on GitHub ↗
(self, wait_trn_id, timeout)

Source from the content-addressed store, hash-verified

87 #
88
89 def _pollForNetBIOSPacket(self, wait_trn_id, timeout):
90 end_time = time.time() - timeout
91 while True:
92 try:
93 _timeout = time.time()-end_time
94 if _timeout <= 0:
95 return None
96
97 ready, _, _ = select.select([ self.sock.fileno() ], [ ], [ ], _timeout)
98 if not ready:
99 return None
100
101 data, _ = self.sock.recvfrom(0xFFFF)
102 if len(data) == 0:
103 raise NotConnectedError
104
105 trn_id, ret = self.decodePacket(data)
106
107 if trn_id == wait_trn_id:
108 return ret
109 except select.error as ex:
110 if type(ex) is tuple:
111 if ex[0] != errno.EINTR and ex[0] != errno.EAGAIN:
112 raise ex
113 else:
114 raise ex
115
116 #
117 # Contributed by Jason Anderson

Callers 1

queryNameMethod · 0.95

Calls 1

decodePacketMethod · 0.80

Tested by

no test coverage detected