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.

66 lines
2.0 KiB

  1. use Win32::Pipe;
  2. ####
  3. # You may notice that named pipe names are case INsensitive!
  4. ####
  5. $PipeName = "\\\\.\\pipe\\TEST this LoNG Named Pipe!";
  6. print "I am falling asleep for few seconds, so that we give time\nFor the server to get up and running.\n";
  7. sleep(4);
  8. print "\nOpening a pipe ...\n";
  9. if ($Pipe = new Win32::Pipe($PipeName)){
  10. print "\n\nPipe has been opened, writing data to it...\n";
  11. print "-------------------------------------------\n";
  12. $iFlag2 = 1;
  13. $Pipe->Write( "\n" . Win32::Pipe::Credit() . "\n\n");
  14. while($iFlag2){
  15. print "\nCommands:\n";
  16. print " FILE:xxxxx Dumps the file xxxxx.\n";
  17. print " Credit Dumps the credit screen.\n";
  18. print " Quit Quits this client (server remains running).\n";
  19. print " Exit Exits both client and server.\n";
  20. print " -----------------------------------------\n";
  21. $In = <STDIN>;
  22. chop($In);
  23. if (($File = $In) =~ s/^file:(.*)/$1/i){
  24. if (-s $File){
  25. if (open(FILE, "< $File")){
  26. while ($File = <FILE>){
  27. $In .= $File;
  28. };
  29. close(FILE);
  30. undef $File;
  31. }
  32. }
  33. }
  34. if($In =~ /^credit$/i){
  35. $In = "\n" . Win32::Pipe::Credit() . "\n\n";
  36. }
  37. $iFlag2 = $Pipe->Write("$In");
  38. if($In =~ /^(exit|quit)$/i){
  39. print "\nATTENTION: Closing due to user request.\n";
  40. $iFlag2 = 0;
  41. }
  42. undef $In;
  43. }
  44. $Pipe->Close();
  45. }else{
  46. ($Error, $ErrorText) = Win32::Pipe::Error();
  47. print "Error:$Error \"$ErrorText\"\n";
  48. sleep(4);
  49. }