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

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

Expand Messages
  • 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 1 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 2 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.