-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pipe name handling on client side #9
Comments
This example is oversimplified by the way. I also removed |
In fact, I want to replace var connectionPipeName = $"{PipeName}_{++NextPipeId}"; to var connectionPipeName = $"{PipeName}_{Guid.NewGuid()}"; P.S. I released this change. |
The library also contains public static IReadOnlyCollection<string> GetActivePipes()
{
return Directory
.EnumerateFiles(@"\\.\pipe\")
.Select(path => path.Replace(@"\\.\pipe\", string.Empty))
.ToList();
} But I do not recommend using pipe file enumeration in principle, it is very slow. |
Regarding the problem with invalid characters, yes,
But as I said, |
At the moment I'm trying to figure out why you need to monitor active pipes at all? |
I don't need all the pipes but I just need to have what server uses currently. I see that during operation I can have:
But if the client only knows |
Ok, the problem is clear. I will add a |
I have released a new version. I removed the |
That's a huge change. Thank you for quick reply. I'll try to use this one. And also will try |
The line below adds a number for the given pipe name in specific cases.
H.Pipes/src/libs/H.Pipes/PipeServer.cs
Line 155 in 3894e51
In my case, a long-running windows service acts as the named pipe server. After a while, the numbering became an issue and I missed that part. I thought it is my code. I realized the issue is by design thanks to pipelist tool of Sysinternals. Then, I checked if it is an OS thin or the library and found the line above.
On the client side, I solved the issue by enumerating the named pipes and picking the first one that starts with the specified name.
Helper class with enumeration method.
And on the named pipe client:
You might consider either using it as an example in a sample project or documentation. Or you can add the method in the H.Pipes. It is just an edge case users might face.
The text was updated successfully, but these errors were encountered: