ffalcinelli / pydivert

A Python binding for WinDivert driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

multiprocessing and pydivert

BoerTheun opened this issue · comments

I am not able to start multiple windivert handles with pydivert if it is not in the main program.
I get a runtime error, RuntimeError: WinDivert handle is not open, even if I only start one process.

def inboundFunc():
	w = pydivert.WinDivert("inbound")

	while 1:
		packet = w.recv()
		#dosomething
		w.send(packet)

def outboundFunc():
	w = pydivert.WinDivert("outbound")

	while 1:
		packet = w.recv()
		#dosomething
		w.send(packet)

if __name__ == '__main__':

	p1 = Process(name='inboundProcess', target=inboundFunc)
	p2 = Process(name='outboundProcess', target=outboundFunc)


	p1.start()
	p2.start()

Try call w.open() before while