Loading ...
Sorry, an error occurred while loading the content.

6289using soap:lite as daemon, capturing the clients IP ?? Help

Expand Messages
  • killyourspam
    Feb 17, 2009
    • 0 Attachment
      Trying to find a way to get a hold of the client's IP as they
      come to the soap daemon server..




      Date: Tue, 17 Feb 2009 21:23:59 GMT
      Server: libwww-perl-daemon/1.36
      Content-Length: 5860
      Content-Type: text/xml; charset=utf-8
      Client-Date: Tue, 17 Feb 2009 21:23:59 GMT
      Client-Peer: 127.0.0.1:88
      Client-Response-Num: 1
      SOAPServer: SOAP::Lite/Perl/0.710.08

      here is my server script
      #!/usr/bin/perl -w
      # -- SOAP::Lite -- soaplite.com -- Copyright (C) 2001 Paul Kulchenko -
      use strict;
      use DBI;
      use SOAP::payload ;
      use Data::Dumper;
      use SOAP::Transport::HTTP

      $SIG{PIPE} = $SIG{INT} = 'IGNORE'; # don't want to die on 'Broken
      pipe' or Ctrl-C

      my $daemon = SOAP::Transport::HTTP::Daemon
      -> new (LocalAddr => 'localhost', LocalPort => 88, 'Reuse' => 1 )
      -> objects_by_reference(qw(My::PersistentIterator
      My::SessionIterator My::Chat SOAP::payload))
      -> dispatch_to('/home/tmoore/soap', 'Module::Hello', 'Module::HIBY')
      -> options({compress_threshold => 10000});
      print "Contact to SOAP server at ", $daemon->url, "\n";
      $daemon->handle;

      ###################################
      this works great but how can I obtain the clients IP address showing
      up at port 88 to get service.

      I can go back to the cgi version to use apache and its logging but
      that is way to easy.

      I dug into the IO::Socket modules looking for things but was not
      able to put anything together using the soap modules.


      use Socket;
      $mysockaddr = getsockname(SOCK);
      ($port, $myaddr) = sockaddr_in($mysockaddr);
      printf "Connect to %s [%s]\n",
      scalar gethostbyaddr($myaddr, AF_INET),
      inet_ntoa($myaddr);


      use Socket;
      $hersockaddr = getpeername(SOCK);
      ($port, $iaddr) = sockaddr_in($hersockaddr);
      $herhostname = gethostbyaddr($iaddr, AF_INET);
      $herstraddr = inet_ntoa($iaddr);


      Thanks in advance for tips on capuring at client IP ..
    • Show all 3 messages in this topic