in reply to Re: Re: Re: Re: IO::Socket
in thread IO::Socket

The client needs to make use of the PeerAddr field in your IO::Socket::INET constructor, or via the object's connect call. Any valid IP/hostname for the server should work fine. Note that IO::Socket reports its errors in $@, not $!, so printing out the value of this variable may be helpful in identifying the problem. There's no reason this shouldn't work, unless the problem is external (firewall or network), or if you're using an invalid hostname/IP.

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: IO::Socket
by dsb (Chaplain) on Feb 08, 2001 at 00:24 UTC
    Okay. This is the code I am using to create the client socket. I have tried the PeerAddr with both a 4 byte IP number, and the domain name and nothing has worked. It dies with the IP, and it hangs with the domain.
    $sock = new IO::Socket::INET( PeerAddr => 'dev01.nerds.com', PeerPort => 1200, Proto => 'tcp', Type => SOCK_STREAM );
    What am I doing wrong? I am at a total loss. - kel -

      Well, if you still have LocalAddr=>'localhost', then the above won't connect because the server won't be listening at the address you are trying to connect via.

      As kschwab pointed out, using LocalAddr in a server is almost always a mistake (and it is a very common mistake).

              - tye (but my friends call me "Tye")
        No. I took LocalAddr out of the server script. That way it should listen at every possible place right? - kel -
      Try connecting to the server program with telnet from the machine where you're running the client program. % telnet dev01.nerds.com 1200 If that doesn't work, then the problem probably isn't in your client program.
        That box uses SSH1. Is that why I am having all these problems? If you say yes I am going to blow something up. :) - kel -