"Michael Weber" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a script that listens on a port for a connection, receives some
> data over that connection, and writes it to a file.
>
> This works, but it takes up CPU cycles, RAM etc. when it waits.  I am
> trying to get the script to use xinetd instead.  That way the tcp daemon
> will launch it when needed and let it die when it's done.
>

Just a tip, but when I do something like you are doing below, I use Apache
and write a simple cgi program to do this. Kind of like a "virtual daemon"
if you will.

without the security checks, my "daemon" may look like this:

use CGI;

my($q) = CGI->new();
> open(LOGFILE, ">/var/log/nukem.log");
> print LOGFILE "Got IP address of ", $q->param('ip'), "\n";
> close(LOGFILE);

Then in your client program, you can do something like:

use CGI qw(:standard);
use LWP::Simple;

my($ip) = '192.168.1.1';

my($content) = get( 'http://somehost/myIpLogger.cgi?ip=' . $ip )

print header();

if ( $content ) {
  print("log request succeded: $content\n");
} else {
  print("log request failed\n");
}

> chomp $ip_addr;
>
> open(LOGFILE, ">/var/log/nukem.log");
> print LOGFILE "Got IP address of $ip_addr\n";
>
> close(LOGFILE);
>

Todd W.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to