Greetings all!
Anyway excuse my English.

I can't understand how I can do this:

<loop cycle; variable is filled by some values>
<loop is still running, but simultaneously another command is running>
<loop is terminated; i want to read variable>

More specifically (it concerned with Scapy module, but I'll explain the detailes):

# sniff() command reads packets from network interface in loop and puts them as list to variable 'a'
a = sniff()

# now I want sniff() to be running and to run another command - ping host

# now I want to terminate sniff() loop and to see what in variable 'a'
print a

May be somebody who do parallel programming knows how I can do that?

7 Years
Discussion Span
Last Post by woooee

I would use multiprocessing. See Doug Hellmann's "Signaling between processes with event objects" here. In multiprocessing, you can also use a dictionary or list to store a value. Some examples, plus see "shared namespaces" here. Start with running two processes and then add in the variable.

Edited by woooee: n/a

Votes + Comments
good info
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.