'NamedPipeWrapper: pipe server stops receiving client messages after an exception occurs
I have this code to implement name pipes using NamedPipeWrapper library:
_pipeServer = new NamedPipeServer<CommandServer.Ipc.Message>(CommandServer.Command.PipeServerName);
_pipeServer.ClientConnected += delegate (NamedPipeConnection<CommandServer.Ipc.Message, CommandServer.Ipc.Message> connection)
{
////
};
_pipeServer.ClientDisconnected += delegate (NamedPipeConnection<CommandServer.Ipc.Message, CommandServer.Ipc.Message> connection)
{
////
};
_pipeServer.Error += delegate (Exception exception)
{
////
};
_pipeServer.ClientMessage += delegate (NamedPipeConnection<CommandServer.Ipc.Message, CommandServer.Ipc.Message> connection, CommandServer.Ipc.Message message)
{
////
};
After I start the server, all works perfecly. Clients connect and can send messages normally. _pipeServer.ClientMessage event is called for every client message, however, if inside that event an exception occurs, server stops receiving client messages.
I tried to start the server again in the _pipeServer.Error event, but it did not work either.
The only way to restart communication, is by closing the application which starts the server and then re-opening it (pipe clients connect automatically just after the server is started so the server is able to receive messages again).
Thanks Jaime
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
