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

Accessing Client IP from SOAP::Transport::HTTP::Daemon

Expand Messages
  • Nils Sowen
    Is it somehow possible to access the peer IP address when using SOAP::Transport::HTTP::Daemon? When browsing through the manpage for HTTP::Daemon I realized
    Message 1 of 3 , Sep 1, 2004
    • 0 Attachment
      Is it somehow possible to access the peer IP address when using
      SOAP::Transport::HTTP::Daemon?

      When browsing through the manpage for HTTP::Daemon I realized that the
      method accept() returns a ClientConn Object as well as the peer-address.

      So I patched the SOAP::Transport::HTTP::Daemon class and printed out
      the value returned in line 434:

      --
      while (my ($c,$peer) = $self->accept) {
      --

      But it only outputs crazy chars. Ideas anyone?

      Byebye,
      Nils
    • Nils Sowen
      Ok, found it out myself;) ... while (my ($c,$peer) = $self- accept) { my $sockaddr_template = S n a4 x8 ; my ($af,$client_port,$client_ip) = unpack($sock
      Message 2 of 3 , Sep 1, 2004
      • 0 Attachment
        Ok, found it out myself;)

        > So I patched the SOAP::Transport::HTTP::Daemon class and printed out
        > the value returned in line 434:
        >
        > --
        > while (my ($c,$peer) = $self->accept) {
        > --
        >
        > But it only outputs crazy chars. Ideas anyone?

        while (my ($c,$peer) = $self->accept) {
        my $sockaddr_template = 'S n a4 x8';
        my ($af,$client_port,$client_ip) = unpack($sock
        addr_template,$peer);
        my @inetaddr = unpack('C4',$client_ip);
        print "$af connection from ".join ('.', @inetad
        dr).":$client_port\n";
        ...

        Bye,
        Nils
      • Mark Fuller
        A function exists to convert the packed network address to unpacked inet_ntoa($iaddr) You may have to use Socket . Mark ... _______________________________ Do
        Message 3 of 3 , Sep 1, 2004
        • 0 Attachment
          A function exists to convert the packed network
          address to unpacked

          inet_ntoa($iaddr)

          You may have to "use Socket".

          Mark

          --- Nils Sowen <n.sowen@...> wrote:

          > Ok, found it out myself;)
          >
          > > So I patched the SOAP::Transport::HTTP::Daemon
          > class and printed out
          > > the value returned in line 434:
          > >
          > > --
          > > while (my ($c,$peer) = $self->accept) {
          > > --
          > >
          > > But it only outputs crazy chars. Ideas anyone?
          >
          > while (my ($c,$peer) = $self->accept) {
          > my $sockaddr_template = 'S n a4 x8';
          > my ($af,$client_port,$client_ip) = unpack($sock
          > addr_template,$peer);
          > my @inetaddr = unpack('C4',$client_ip);
          > print "$af connection from ".join ('.', @inetad
          > dr).":$client_port\n";
          > ...
          >
          > Bye,
          > Nils
          >
          >




          _______________________________
          Do you Yahoo!?
          Win 1 of 4,000 free domain names from Yahoo! Enter now.
          http://promotions.yahoo.com/goldrush
        Your message has been successfully submitted and would be delivered to recipients shortly.