On Mar 10, 10:06 am, Minesh Patel <min...@gmail.com> wrote: > On Mon, Mar 9, 2009 at 2:47 PM, <ommer.sim...@gmail.com> wrote: > > I'm trying to figure out parallel process python code. Something > > similar to fork funtion in C. > > > For example, I using sniff tool in scapy to capture packets but i want > > this to run in the background: > > > ------- > > from scapy.all import * > > import subprocess > > import netsnmp > > > pkts=sniff(iface="eth0",filter="UDP",count=100) # This should run in > > the background > > > print "Next Code."' > > --------- > > > "Next Code." should be printed out right away and does not have to > > wait for pkts=sniff(...) to finish. > > > Any ideas? > > Why not use os.fork(), it is the same as C's fork? > > if os.fork(): # Returns 0 to child, non-zero to parent > # Do parent stuff > else: > # Do child stuff > > -- > Thanks, > Minesh Patel
Thanks,It works perfectly. -- http://mail.python.org/mailman/listinfo/python-list