Created
May 16, 2016 13:19
-
-
Save ch-hristov/e4c1bf4d62d2dcdae7def2d81dc45c17 to your computer and use it in GitHub Desktop.
pipe listener
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
using (var server = new NamedPipeServerStream(_identifier.ToString())) | |
using (var reader = new StreamReader(server)) | |
{ | |
server.WaitForConnection(); | |
var arguments = new List<String>(); | |
while (server.IsConnected) | |
arguments.Add(reader.ReadLine()); | |
ThreadPool.QueueUserWorkItem(CallOnArgumentsReceived, arguments.ToArray()); | |
} | |
} | |
catch (IOException) | |
{ } //Pipe was broken | |
finally | |
{ | |
ListenForArguments(null); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment