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

From: Old Fart (OldFart_at_newsgroups.nospam)
Date: 06/19/04

  • Next message: Lekomtsev Dmitri: "Re: How to obtain NetBIOS name from IP Address without NetBIOS API"
    Date: Fri, 18 Jun 2004 22:18:40 -0700
    
    

    I don't know if you are purposely missing the whole point of this discussion
    or if you really don't understand what I'm complaining about.

    Perhaps you don't understand what I mean when I say the WriteFile is
    "blocked". I don't mean that it is not completing. I do mean that
    WriteFile is not returning (so I can go on and do other things) until the
    write has actually completed, which in the case of a wait-mode named pipe
    means that the peer has actually read the data. Overlapped WriteFile calls
    should return (nearly) immediately, regardless of whether or not the write
    has actually completed. That is not happening in this case.

    As I've explained twice before, I have narrowed the problem down a bit. If
    the client opens the named pipe using "." as the server name, the WriteFile
    calls return immediately, as expected, whether or not the write operation
    has actually completed. If the client opens the named pipe using a server
    name, even if the server name happens to be the same machine as the client
    is running on, then the WriteFile calls do not return until the write
    operation is completed. This is not the way overlapped I/O should work! It
    sure looks like a named pipe bug to me.

    Please, give me some clue that you have even a vague understanding of what I
    am trying to say. This whole discussion reminds me of an old joke:

    A pilot is flying a helicopter in Washington state. He gets lost. He sees
    a building with someone standing on the roof and yells to him, "Where am I?"
    The person answers, "You're in a helicopter hovering above our building."
    The pilot says "Thank you" and immediately heads for Sea-Tac. A passenger
    asks the pilot, "How did you know where we were from that answer?" The
    pilot responds, "Well, the answer was 100% correct and utterly useless. I
    knew we must be at Microsoft's technical support center."

    "Rhett Gong [MSFT]" <v-raygon@online.microsoft.com> wrote in message
    news:HqdByXOVEHA.2764@cpmsftngxa10.phx.gbl...
    > ;-) since you add 5s sleep in the server read thread, then ---
    > When client writefile, your server read thread enter into sleep, so you
    have no thread
    > in server for the read transaction, the file will be written to cache and
    no error
    > returned to the client.
    > I get following debug log for this scenario
    > >Client --- Enter WriteFile
    > >Client --- WriteFile immediately returned with error 0x0
    > >Server -- Enter Sleep
    > >Server -- ReadFile IO Pending
    > However, if the sleep is over and you are writting file at just time, then
    997 is
    > returned as expected.
    >
    > From the log, you can see the sleep does not help anything but messes up
    our program.
    > So I suggest you removing this sleep and try dealing with read pending by
    yourself.
    > Thanks.
    >
    >
    > Have a nice day!
    > 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.
    >


  • Next message: Lekomtsev Dmitri: "Re: How to obtain NetBIOS name from IP Address without NetBIOS API"

    Relevant Pages

    • Re: Why is my overlapped WriteFile getting blocked? (repost)
      ... The "server bug" was that it was never ... the client would connect to the named pipe ... and get blocked on the first WriteFile. ... I ran both the client and server on the same PC and opened the client pipe ...
      (microsoft.public.win32.programmer.networks)
    • Re: Asynchronous sockets and buffer size
      ... it appears that his server won't send data until the ... if the client socket disconnects after completing the first send and ... server socket did not send any data prior to it, then client will receive no ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: CreateNamedPipe... then what?
      ... > Or with CallNamedPipe? ... the client and server can both use WriteFile. ...
      (borland.public.delphi.nativeapi)
    • Re: Why is my overlapped WriteFile getting blocked? (repost)
      ... In the server, I added a Sleepjust before the ReadFile call in the do ... In the client I added several trace statements. ... Another reporting that WriteFile had returned an error. ...
      (microsoft.public.win32.programmer.networks)
    • Re: Why is my overlapped WriteFile getting blocked? (repost)
      ... run the client on Win2K and the server on XP, ... 3622687: Calling WriteFile ... > pipe name, WriteFile could return immediately. ...
      (microsoft.public.win32.programmer.networks)

    Loading