named-pipe-wrapper
named-pipe-wrapper copied to clipboard
Server stops receiving client messages after an exception occurs
Hello,
I am using this code to receive messages from pipe clients:
_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)
{
////
};
Almost all works perfectly. _pipeServer.ClientMessage continues receiving messages from clients, however, when inside ClientMessage an exception occurs and the _pipeServer.Error event is called, server stops receiving client messages.
I tried calling _pipeServer.Start(); again in the Error event, but it did not work.
If I close the server application and start it again, it starts receiving client messages again.
Any help, please?
Thanks Jaime