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.

51 lines
1.7 KiB

  1. use Win32::Pipe;
  2. $PipeName = "TEST this long named pipe!";
  3. $NewSize = 2048;
  4. $iFlag = 1;
  5. while($iFlag){
  6. print "Creating pipe \"$PipeName\".\n";
  7. if($Pipe = new Win32::Pipe($PipeName)){
  8. $PipeSize = $Pipe->BufferSize();
  9. print "This pipe's current size is $PipeSize byte" . (($PipeSize == 1)? "":"s") . ".\nWe shall change it to $NewSize ...";
  10. print (($Pipe->ResizeBuffer($NewSize) == $NewSize)? "Successful":"Unsucessful") . "!\n\n";
  11. print "\n\nR e a d y f o r r e a d i n g :\n";
  12. print "-----------------------------------\n";
  13. $iFlag2 = 1;
  14. print "Openning the pipe...\n";
  15. undef $In;
  16. while($Pipe->Connect()){
  17. while($iFlag2){
  18. ++$iMessage;
  19. print "Reading Message #$iMessage: ";
  20. $In = $Pipe->Read();
  21. if(! $In){
  22. $iFlag2 = 0;
  23. print "Recieved no data, closing connection....\n";
  24. next;
  25. }
  26. # $In =~ s/\n*$//gi;
  27. if ($In =~ /^quit/i){
  28. print "\n\nQuitting this connection....\n";
  29. $iFlag2 = 0;
  30. }elsif ($In =~ /^exit/i){
  31. print "\n\nExitting.....\n";
  32. $iFlag2 = $iFlag = 0;
  33. }else{
  34. print "\"$In\"\n";
  35. }
  36. }
  37. print "Disconnecting...\n";
  38. $Pipe->Disconnect();
  39. }
  40. $Pipe->Close();
  41. }
  42. }