Villu
2008-12-05 16:51:01 UTC
Hi..
I was able to pass string messages in NamedPipes, for communicating between
two running exes, but I actually want to pass objects.
The steps I used to send string message from server exe to client exe
I created Named Pipe in the server exe using
NamedPipeServerStream objPipe = new NamedPipeServerStream("MyPipeName",
PipeDirection.Out,
1,
PipeTransmissionMode.Message,
PipeOptions.Asynchronous,
BUFFER_SIZE,
BUFFER_SIZE);
I write into the pipe using...
StreamWriter objWriter = new StreamWriter(objPipe);
objWriter.WriteLine("Message to client");
Now, in the client... I connected to the pipe server pipe using....
NamedPipeClientStream objPipe = new NamedPipeClientStream(".",
"MyPipeName",
PipeDirection.InOut,
PipeOptions.Asynchronous);
objPipe .Connect();
objPipe .ReadMode = PipeTransmissionMode.Message;
I read from the pipe using
byte[] buffer = new byte[BUFFER_SIZE];
ObjPipe.Read(buffer, 0, buffer.Length));
Can anyone help me to change this to pass objects instead of a string
message between the exes
I got the code from article
http://blog.benday.com/archive/2008/06/22/23182.aspx
- villu
I was able to pass string messages in NamedPipes, for communicating between
two running exes, but I actually want to pass objects.
The steps I used to send string message from server exe to client exe
I created Named Pipe in the server exe using
NamedPipeServerStream objPipe = new NamedPipeServerStream("MyPipeName",
PipeDirection.Out,
1,
PipeTransmissionMode.Message,
PipeOptions.Asynchronous,
BUFFER_SIZE,
BUFFER_SIZE);
I write into the pipe using...
StreamWriter objWriter = new StreamWriter(objPipe);
objWriter.WriteLine("Message to client");
Now, in the client... I connected to the pipe server pipe using....
NamedPipeClientStream objPipe = new NamedPipeClientStream(".",
"MyPipeName",
PipeDirection.InOut,
PipeOptions.Asynchronous);
objPipe .Connect();
objPipe .ReadMode = PipeTransmissionMode.Message;
I read from the pipe using
byte[] buffer = new byte[BUFFER_SIZE];
ObjPipe.Read(buffer, 0, buffer.Length));
Can anyone help me to change this to pass objects instead of a string
message between the exes
I got the code from article
http://blog.benday.com/archive/2008/06/22/23182.aspx
- villu