Re: Net::TFTPd

[email protected] (Ask Bjørn Hansen) Fri, 18 Mar 2011 14:06:52 -0700
Newsgroups perl.copenhagen
Message-ID <[email protected]>
On Mar 18, 2011, at 13:53, Thomas Elsgaard wrote:


> my $tftpRQ = $tftpdOBJ->waitRQ(10)
> 	    or die "Error waiting for TFTP request: %s", Net::TFTPd->error;
> 
> $tftpRQ->processRQ()
> 	      or die "Error processing TFTP request: %s", Net::TFTPd->error;


Burde nok være:

while (1) {

    if (my $tftpRQ = $tftpdOBJ->waitRQ(10)) {
      if (fork) {
         # parent
         next;
      }
      else {
          # child, processing the request
          $tftpRQ->processRQ()
	      or die "Error processing TFTP request: %s", Net::TFTPd->error;
        }
    }
    else {
        say "Jeg keder mig..."
    }
}

> When the method returns, the program should fork() and process the
> request invoking processRQ() while the parent process should re-start
> waiting for another request.

Jeg tror han med "restart" bare mener "start forfra i loop'et".



 - ask