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

Socket timeout specification

Expand Messages
  • u_shefi
    Hi I am using the Socket object to do a whois script, but I don t know how to set the timeout for the query. here is part of the code:
    Message 1 of 2 , May 28, 2003
    • 0 Attachment
      Hi

      I am using the Socket object to do a whois script, but I don't know
      how to set the timeout for the query.

      here is part of the code:
      =================================
      $port = getservbyname('whois','tcp');
      $iaddr = inet_aton($server) || &error("whois error, Error No
      Such Host: $server");
      $paddr = sockaddr_in($port, $iaddr);
      $proto = getprotobyname('tcp');
      socket(SOCK, PF_INET, SOCK_STREAM, $proto) || &error("whois
      error, socket: $!");
      connect(SOCK, $paddr) || &error("whois error, $! $server");
      select SOCK;
      $| = 1;
      print SOCK "$domain\015\012";
      select STDOUT;
      while($out = <SOCK>)
      { print $out; }
      close (SOCK);
      =================================

      Where can I set the timeout, or is it set here and I don't even
      know? :)

      Please help
    Your message has been successfully submitted and would be delivered to recipients shortly.