in reply to Re: IO::Socket to me. . . or why won't you stay?
in thread IO::Socket to me. . . or why won't you stay?

Forgive me, but how would you force it to reconnect without creating a new socket? If it's true that a whois server hangs up after each query, then reconnecting without creating a new socket seems like a good compromise.

Thanks, tadman.

  • Comment on Re: Re: IO::Socket to me. . . or why won't you stay?

Replies are listed 'Best First'.
Re^3: IO::Socket to me. . . or why won't you stay?
by tadman (Prior) on Aug 01, 2001 at 19:05 UTC
    It seems that I'm making assumptions about the functionality of IO::Socket::INET that just aren't true. For example, you can't really reconnect unless you jump through a bunch of hoops. The $socket->connect() method, for example, is no more robust than the internal one. You need to resolve your addresses first using gethostbyaddr, which is inconvenient, to say the least. So it can be done, but the cost is too high to make it practical.

    Maybe this will be fixed in an upcoming release.

    In the interim, recreating the socket doesn't seem like such a big deal after all. It will certainly work.

      Yeah, it does work and works fine when I create a new socket for each request. I guess I just like persistent connections, like Apache::DBI, but this may not be possible with a socket.

      Doing this I kind of feel like a script-kiddie, like I'm not really understanding what's happening, even though I can get it work and have read the docs, camel, and Cookbook entries on IO::Socket.

      Oh well. I'm sure true socket enlightenment is close. . .

        In this case, you're not able to keep a connection open because the WHOIS protocol does not allow it. HTTP, on the other hand, has a "KeepAlive" feature which allows the socket to remain open for other transmissions.

        You may also want to look into the RWHOIS protocol, which is supposed to be replacing the old, and very tired WHOIS. If any functional improvements are to be made, this is where they will occur.