Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
618 B

  1. use Socket;
  2. @ARGV || die "Server name required!\n";
  3. $remote = $ARGV[0];
  4. print "Connecting to $remote...\n";
  5. $iaddr = inet_aton($remote) || die "no host: $remote";
  6. $paddr = sockaddr_in(80, $iaddr);
  7. socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp')) || die "socket: $!";
  8. connect(SOCK, $paddr);
  9. print "Connected\n";
  10. select((select(SOCK), $| = 1)[0]);
  11. while( defined( $line = <STDIN> ) )
  12. {
  13. chop $line;
  14. $line = $line . "\015\012";
  15. print SOCK $line;
  16. }
  17. print "Waiting for response\n";
  18. while( 1 )
  19. {
  20. $var = 1;
  21. read( SOCK, $var, 1);
  22. print $var;
  23. }