Newbie: Keep TCP socket open

Roy Smith roy at panix.com
Wed May 21 08:27:15 EDT 2008


In article <iaidnR_ZuNB9YK7VnZ2dnUVZ8uednZ2d at pipex.net>,
 "Alan Wright" <alan.wright at volubill.com> wrote:

> Thanks Roy
> 
> Any ideas how to code this child process stuff, as I said I am newbie and 
> not from a coding background

The easiest thing would be to use os.system().  If you wanted to spawn 10 
child processes, you could do:

import os
for i in range(10):
    os.system ("./child.py &")

and then have child.py be a script that creates 1000 TCP connections.

Keep in mind that one man's stress test is another man's denial of service 
attack.  If there are any firewalls between you and your target, they may 
restrict the number of connections you get to make (or the rate at which 
they're created).  You may also get a polite phone call from your local IT 
people asking enquiring about your activities.



More information about the Python-list mailing list