Skip to content
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

Does this library support read-only or write-only? #39

Closed
finnonly opened this issue Dec 8, 2023 · 11 comments
Closed

Does this library support read-only or write-only? #39

finnonly opened this issue Dec 8, 2023 · 11 comments

Comments

@finnonly
Copy link

finnonly commented Dec 8, 2023

CreatePipeStreamFunc = (pipeName) => new NamedPipeServerStream(pipeName, PipeDirection.Out, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous | PipeOptions.WriteThrough);

When customizing a NamedPipeServerStream, the client connects and prompts that reading the stream is not supported.

@HavenDV
Copy link
Owner

HavenDV commented Dec 8, 2023

Currently the main pipe for creating connections and the additional pipes for the connections themselves use the same method, so this is not possible for the main client (but will most likely work with SingleConnection versions of clients)

@HavenDV
Copy link
Owner

HavenDV commented Dec 8, 2023

I added PipeServer.CreatePipeStreamForConnectionFunc in latest release now, please try to set up this for CreatePipeStreamForConnectionFunc and test

@finnonly
Copy link
Author

finnonly commented Dec 8, 2023

PipeServer.CreatePipeStreamForConnectionFunc No effect

PipeConnection has a reading thread. If it is set to write only, ReadAsync will prompt that reading is not supported.

@HavenDV
Copy link
Owner

HavenDV commented Dec 8, 2023

I created test for WriteOnly server case and disabled reading thread if PipeStream does not have Read capabilities. It should be released soon in 2.1.0.

@finnonly
Copy link
Author

finnonly commented Dec 8, 2023

Looking forward to the release of the new version.😊

@HavenDV
Copy link
Owner

HavenDV commented Dec 8, 2023

Unfortunately, I'm running macOS and it worked correctly, but the Windows tests failed with an exception and I'm trying to fix it:

   Test method H.Pipes.Tests.Tests.WriteOnlyServer threw exception: 
System.AggregateException: One or more errors occurred. (Access to the path is denied.) ---> System.UnauthorizedAccessException: Access to the path is denied.
  Stack Trace:
      at System.IO.Pipes.NamedPipeClientStream.TryConnect(Int32 timeout, CancellationToken cancellationToken)
   at System.IO.Pipes.NamedPipeClientStream.ConnectInternal(Int32 timeout, CancellationToken cancellationToken, Int32 startTime)

@finnonly
Copy link
Author

finnonly commented Dec 8, 2023

Hi, have you found your problem?
I tried to set PipeDirection.In on the server, but it was still PipeDirection.InOut on the client. I got the same error as you.
PipeDirection.In and PipeDirection.Out need to be connected one-to-one so that there will be no

@HavenDV
Copy link
Owner

HavenDV commented Dec 8, 2023

Unfortunately stuck with this. I will release a new prerelease version with the ability to set CreatePipeStreamForConnectionFunc for the client, you can help if you check different options

@finnonly
Copy link
Author

I roughly looked at the PipeConnection code, and there is a start method. If the NamedPipeClientStream is in the write-only state, I think PipeConnection.ReadWorker does not need to be run.

@HavenDV
Copy link
Owner

HavenDV commented Dec 13, 2023

image

I think this is already being processed, maybe I should move it outside of the ReadWorker, but I was afraid of breaking something

@finnonly
Copy link
Author

finnonly commented Mar 4, 2024

After testing the 2.1.0-dev322 version, it seems that it can only read and write. Close this issue.

@finnonly finnonly closed this as completed Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants