XPost: comp.os.ms-windows.networking.tcp-ip   
   From: nospam@mutluit.com   
      
   info.mutluit.com has some useful public net services at tcp port 8442   
      
   Some useful services with pure text output (no HTML/XML/JSON etc.)   
   for easy/automatic processing by scripts and programs:   
      
    myip - gives your public ip adress   
    myhost - gives the corrosponding dns host name entry of your   
   public ip   
    myport - gives your public port for the current connection (for   
   diagnostics)   
      
    ip - gives ip of the given host name   
    host - gives hostname of the given ip   
      
    comparemyip - compares your public ip or   
   hostname with the given ip or hostname (retcode 0 means "it matches")   
    compareip - compares 2 ip or hostnames   
   (retcode 0 means "it matches")   
      
    pingmyport {tcp | udp} - will ping your given port at your   
   public ip (retcode 0 means "is available")   
    pingport {tcp | udp} - will ping the given port of the   
   given ip or host (retcode 0 means "is available")   
      
    domain - gives the domain part (sld.tld)   
    subdomain - gives subdomain part (that in front of the sld.tld)   
      
    echo - echos back the given string   
    discard [] - just accepts and discards the given string   
      
    lcq - generates a (unique) int value from a linear   
   congruential generator with a long period   
      
    help - gives a list of all commands (not all are implemented   
   yet) with their syntax   
      
    ...   
      
      
   REMARKS:   
    "comparemyip" can be used to detect ip changes, for example comparing with   
   your registered dyndns ip...   
    "pingmyport" and "pingport" do monitor (scan) a port for availablity of the   
   underlying service at that port.   
    "--noads" as last parameter suppresses ad output in the result.   
    More commands and options to come soon.   
    It's running as a C++ service (daemon) on Linux, but it's use is platform   
   independent;   
    ie. it can also be used by Windows clients, or from embedded devices,   
   smartphones etc.   
    At this stage every aspect of this service is experimental and just in pre   
   beta test phase.   
    For questions, feature requests and project offers please contact the author   
   U.Mutlu at service @ mutluit.com .   
      
      
   HOWTO make use of it:   
    This is intended for tcp/socket programmers.   
    The command must be sent and the result picked up via a normal tcp   
   connection.   
    It is intended to automate jobs (for example detecting (dynamic) ip changes   
   and taking further neccessary actions)   
      
      
   SAMPLE CLIENT:   
    A sample client written in the programming language C/C++ will follow soon.   
    Here's a simple (linux) Perl script named "conn" for testing.   
    Pass "tcp" as protocol, like this "./conn info.mutluit.com 8442 tcp help" :   
      
   #!/usr/bin/perl -w   
   #   
   # filename: conn   
   #   
   # sample client for info.mutluit.com net services api   
   #   
   # (c) 2011 U.Mutlu < service @ mutluit.com >   
   #   
   # 2011-08-27-Sa v1.00 Init   
   # 2011-10-09-Su v1.01 minor updates   
   #   
   # Example usage:   
   # ./conn info.mutluit.com 8442 tcp help   
   #   
      
   use IO::Socket;   
      
   sub conn {   
    my $server = $_[0];   
    my $port = $_[1];   
    my $proto = $_[2];   
    my $sPar = $_[3];   
      
    my $hSock = new IO::Socket::INET(PeerAddr => $server, PeerPort => $port,   
   Proto => $proto);   
    die "Could not create socket: $!\n" unless $hSock;   
      
    if ($sPar ne "") {   
    print $hSock "$sPar\n";   
    }   
      
    my $sRes = <$hSock>; # 1st line   
      
    # rest:   
    my $sLine;   
    while ($sLine = <$hSock>) {   
    $sRes .= "$sLine";   
    }   
      
    close($hSock);   
    return $sRes;   
   }   
      
   if (@ARGV < 3) {   
    print "Usage: conn server port tcp|udp [param ...]\n";   
    print "Example: conn info.mutluit.com 8442 tcp help\n";   
    exit 1;   
   }   
      
   my $sPar = "";   
   for ($i = 3; $i < @ARGV; $i++) {   
    $sPar .= "$ARGV[$i] ";   
   }   
      
   #print "DBG: server=$ARGV[0] port=$ARGV[1] proto=$ARGV[2] param=$sPar\n";   
      
   my $sRes = conn($ARGV[0], $ARGV[1], $ARGV[2], $sPar);   
   print "$sRes";   
      
   exit 0;   
   ############   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|