CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
script hangs until a system() call finishes



May 11, 2009, 7:59 AM

Post #1 of 2 (503 views)
script hangs until a system() call finishes Can't Post

Hi -

I have been Perl scripting for a couple of months now. I'm writing a basic script that can read and write variables to and from 2 different computers, using Netcat. My problem, is that when I run my will open the netcat tunnel to the PC in listening mode....dump the 1st thing its supposed to dump...and then hang there (it keeps the netcat connection open, and doesn't die, so the next variable can be written across).

Has anyone else had any issues with this? Any help would be greatly appreciated - here's a snippet of the code to mull over.


my $pid = fork();

while (1 == 1)

if ($pid == 0)

$read = `type netcat.txt`;
if ($read == '')
system('taskkill /F /IM nc.exe');
# print "$read\n";
system('del netcat.txt');

system('nc 1233 > netcat.txt');

ps - I accidentally posted this in the beginner's thread and realized that this probably isn't a beginner's problem...

New User

May 11, 2009, 10:41 PM

Post #2 of 2 (489 views)
Re: [b34st1y] script hangs until a system() call finishes [In reply to] Can't Post

i clearly didn't understand the issue, did you mean your script is hung at

system('nc 1233 > netcat.txt');

if that is so, and if script is running on windows, you can try following

system('start cmd /c nc 1233 ^> netcat.txt');

^ here is escape sequence.

sorry if i havn't understood the proper problem


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives