title: How to make the script works on IPv6 address
body: <p>I have a client script to receives TCP packet on IPv4 address.
  Now, I need the script receives TCP packet on IPv6 address.
  As I don't know much about perl-Socket, Can you help me modify it ?</p>
  
  <pre><code>use Socket;
  use IO::Handle;
  use constant MY_ECHO_PORT =&gt; 9067;
  $ENV{'PATH'} = "$ENV{'PATH'}:./";
  
  my ($bytes_out,$bytes_in) = (0,0);
  
  my $dt;
  
  my $port = shift || MY_ECHO_PORT;
  my $protocol = getprotobyname('tcp');
  
  local *SESSION;
  local *SOCK;
  
  $SIG{'INT'} = sub {
      close(SESSION) if SESSION;
      shutdown(SOCK,2) if SOCK;
      close(SOCK) if SOCK;
      print STDERR "Mlease agent stopped\n";
      exit 0;
  };
  
  socket(SOCK, AF_INET, SOCK_STREAM, $protocol) or
      die "socket() failed: $!";
  
  setsockopt(SOCK,SOL_SOCKET,SO_REUSEADDR,1) or
      die "Can't set SO_REUSEADDR: $!";
  
  my $my_addr = sockaddr_in($port,INADDR_ANY);
  bind(SOCK,$my_addr) or
      die "bind() failed: $!";
  
  listen(SOCK,SOMAXCONN) or
      die "listen() failed: $!";
  
  print "Mlease agent started on port $port...\n";
  </code></pre>