On Sun, Nov 03, 2002 at 05:12:31PM +0100, K. Hoelzer wrote:
I HAVE SIMPLY ATTACHED IT INLINE !
#!/usr/bin/perl -w # fwdport -- act as proxy forwarder for dedicated services
[ ... ]
# now each twin sits around and ferries lines of data. # see how simple the algorithm is when you can have # multiple threads of control?
# this is the fork's parent, the master's child if ($kidpid) { set_state("$rs_info --> $lc_info"); select($local_client); $| = 1; print while <$remote_server>; kill('TERM', $kidpid); # kill my twin cause we're done } # this is the fork's child, the master's grandchild
[ similar for the other way ] be careful here! you should *not* kill your output twin, just because no more input is available and vice versa. see, for SMTP this might work. but think of on line coming/going out in, requesting huge amount of data. you end up killing your twin whilst it is still processing the request. thats why sockets are not files, and should not be close'd but shutdown'ed. Lars