use strict; use warnings; use HTTP::Proxy; use threads; #Let's define the threads to be undef my $thr1 = undef; my $thr2 = undef; #Control Server my $Server_IP = "192.168.0.1"; my $Server_Port = 30000; $thr1 = threads->create(\&StartServer_HTTP,1); $thr2 = threads->create(\&StartServer_HTTP,2); $thr1->join(); $thr2->join(); sub StartServer_HTTP{ use HTTP::Proxy; my $thid = threads->tid(); my $port = $Server_Port + $thid; print STDOUT "Server started on port: <$port>\n"; my $proxy = HTTP::Proxy->new( host => $Server_IP, max_client => 100, max_keep_alive_requests => 1, port => $port ); $proxy->start; } #### Server started on port: <30001> Server started on port: <30002> Perl exited with active threads: 1 running and unjoined 0 finished and unjoined 0 running and detached Perl exited with active threads: 1 running and unjoined 0 finished and unjoined 0 running and detached Perl exited with active threads: 1 running and unjoined 0 finished and unjoined 0 running and detached