public void OpenListeningPipe() { try { if (_listeningPipe != null) { throw new InvalidOperationException("There is already a pipe listening for a connection"); } _listeningPipe = _platform.CreatePipeByName(_pipeName); _listeningPipe.BeginWaitForConnection(OnNewConnection, _listeningPipe); } catch (Exception e) { LogError("OpenListeningPipe caught unhandled exception", e); } }
public bool Connect() { try { if (_pipe != null) { throw new InvalidOperationException("Pipe server already started"); } _pipe = _platform.CreatePipeByName(_pipeName); _pipe.BeginWaitForConnection(OnConnection, _pipe); return(true); } catch (Exception e) { Log("Unhandled exception during server start", e); } return(false); }