Re: Why is my overlapped WriteFile getting blocked? (repost)

From: Old Fart (oldfart_at_newsgroups.nospam)
Date: 06/14/04


Date: Mon, 14 Jun 2004 09:21:03 -0700

Rhett,

First, I want to clarify something. The "server bug" was that it was never
reading from the named pipe. So, the client would connect to the named pipe
and get blocked on the first WriteFile. Even though the server was not
reading from the pipe, I would not expect an overlapped write to the pipe to
block.

I played around with this a little bit more, using a test program. Here is
what I observed:

I ran both the client and server on the same PC and opened the client pipe
with the path \\.\pipe\NPTest. The WriteFile call returned immediately with
error 997. (This is what I expect and hope for.)

I ran the client on one PC and the server on another. The client pipe was
opened with the path \\otherpc\pipe\NPTest. The WriteFile blocked. (Not
good.) Closing the server pipe resulted in the WriteFile returning error
109. (What I would expect under the circumstances.)

The, just for fun, I tried running both the client and server on the same
PC, but I opened the client side using the path \\samepc\pipe\NPTest. I got
the same results as for the different PCs test. That is, the WriteFile
blocked.

Let me know if you still want the test programs, in light of the information
above.

"Rhett Gong [MSFT]" <v-raygon@online.microsoft.com> wrote in message
news:jY1n1$tTEHA.1900@cpmsftngxa10.phx.gbl...
> We have never seen the WriteFile hang when doing asynchronous operation.
As you said,
> you have a bug inside your server, so the whole operations are under
incorrect state,
> and it is hard to say what cause the problem. If possible, please send me
a *simple*
> repro sample and I can help to check what makes WriteFile hang.
>
> ERROR_IO_PENDING is returned if write operation is not completed before
the WriteFile
> returns. From your description, you have seen completion events are being
properly
> posted to the IOCP, so everything works correctly as expected. If you
expect an
> ERROR_IO_PENDING, you could try WriteFile with a long distant server to
get this error
> returned.
>
>
> Thanks,
> Rhett Gong [MSFT]
> Microsoft Online Partner Support
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> Please reply to newsgroups only. Thanks.
>



Relevant Pages

  • Re: Named pipe problem
    ... When the client opens a pipe on the same machine as ... the server, I get 1 pipe connect request. ... When the same client program on a different computer opens the same pipe I ... I getting 2 connection requests over a network? ...
    (microsoft.public.win32.programmer.networks)
  • Re: Named pipe problem
    ... When the client opens a pipe on the same machine as ... the server, I get 1 pipe connect request. ... When the same client program on a different computer opens the same pipe I ... I getting 2 connection requests over a network? ...
    (microsoft.public.win32.programmer.networks)
  • Re: Why is my overlapped WriteFile getting blocked? (repost)
    ... I don't mean that it is not completing. ... WriteFile is not returning until the ... If the client opens the named pipe using a server ...
    (microsoft.public.win32.programmer.networks)
  • Multithreaded pipe server, deadlock problem
    ... I'm working on a multithreaded pipe server. ... The primary thread create name pipes and if a client is connected, it then create a thread and let the thread procedure "InstanceThread" process the clients. ... // Marker 0 ...
    (microsoft.public.win32.programmer.kernel)
  • Re: A question about Named Pipe?
    ... I have a memory that it will come out of its ReadFile with (or for async, ... the session and it would make no sense to send additional information to the server via ... that pipe. ... >In block mode, once ConnectNamedPipereturns, it means the client called ...
    (microsoft.public.vc.mfc)