in reply to Re^2: server to server communication
in thread server to server communication
Before I go on, I'll just say from the outset that I've not written a lot of code that uses forking, so I won't profess to be an expert on the subject.
However, based on my understanding, here is a simple example to demonstrate how fork works.
#!/usr/bin/perl -wl use strict; defined (my $pid = fork) or die "Cannot fork: $!"; unless ($pid) { for (1 .. 20) { print "CHILD: $_"; sleep 1; } exit 0; } for (1 .. 20) { print "PARENT: $_"; sleep 1; }
When the above is executed, you get both loops printing at the same time. That is, the second loop doesn't wait for the first to complete. Which is pretty much what you are after, no?
Cheers,
Darren :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: server to server communication
by Hammy (Scribe) on Jun 15, 2006 at 20:42 UTC |