Click to See Complete Forum and Search --> : "PeekNamedPipe" fails with "ERROR_FILE_NOT_FOUND"


kdtripathi
December 26th, 2002, 04:11 PM
I have a Pipe Server Windows Service, which starts a new thread for every incoming connection and hits specified URL with incoming data being passed to URL as query string. It collects back response from URL and writes it out to pipe connection.

From my application when I connect to pipe server and write out data, then I enter in a close loop checking after every 100 milliseconds if answer has arrived using “PeekNamedPipe”. Many times in loop “PeekNamedPipe” fails with error code “ERROR_FILE_NOT_FOUND”. When data arrives it does not fails and tells me number by bytes available that I read later which shows that connection has not been dropped. If it is failing due to fact that other end of pipe is busy doing I/O with web server then it should return back something like “Pipe not available”. In any case according to MSDN “PeekNamedPipe” should never fail rather it should come back with number of bytes available to read as 0.

My many thanks for reading post and providing any thoughts as why it could be happening?

DanM
December 27th, 2002, 03:42 AM
Could you please post some code ?

Thanks,

Dan

mwilliamson
December 27th, 2002, 11:59 AM
This may be because you are not specifying security when you create you pipe. You should try logging on your service using a local or domain account, then try connecting to it from the same account. If it turns out this is the problem, you will have to give permission to everyone in your domain or local users.

DanM
December 27th, 2002, 09:42 PM
The original post specified the error occured after some time :Many times in loop “PeekNamedPipe” fails with error code...

If it is a security problem, then my assumption is the error would occur first time not after n loops.

Please correct me if I'm wrong.

Dan

mwilliamson
December 27th, 2002, 10:37 PM
Sorry :) I didn't read it very thoughly I guess.