#! /usr/bin/perl -w use strict; use IO::Socket; my ( $local_host, $iaddr, $host, $port, $user, $paddr, $proto, $line, +$sock_handle ); if($ARGV[0]) { $user=$ARGV[0]; } else { $user = getlogin; } ###################end client.head ###################start Make generated $local_host = "host_name"; $iaddr = 192.168.254.33; $host = '192.168.254.33'; $port = 7797; ###################end Make generated ###################start client.tail $|=1; print "PLEASE do NOT close this window, simply minimize it.\n"; print "Thanks,\n\tDan, your friendly system administrator\n"; #this must be set to the ip address of the accounts server. $paddr = sockaddr_in($port, $iaddr); $proto = getprotobyname('tcp'); $sock_handle = IO::Socket::INET->new(Proto => "tcp", PeerAddr => $host, PeerPort => $port) or die "can't connect to port $port on $host: $!"; $sock_handle->autoflush(1); #send computer and username print $sock_handle "$user\n"; print $sock_handle "$local_host\n"; #register signalhandler $SIG{INT} = \&end; #$SIG{TERM} = \ #now update the server once a while while() { #sleep for 10 minutes sleep(10*60); #notify the server that we are alive print $sock_handle "alive\n" } sub end { my $signame = shift; print $sock_handle "quit\n"; close $sock_handle || die "close: $!"; exit(0); }

Can you help?? :)

Edit: g0n - added code tags


In reply to Re^2: Problem with script not terminating under Windows XP by biochris
in thread Problem with script not terminating under Windows XP by biochris

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.