Re: WriteFile()



> These two statements contradict with your original statement that
> '"synchronous operation" [...] implies block with no timeouts'.

I don't think so. I think I have been very consistent. Synchronous means
BLOCK call with no timeouts. A block call with timeout considerations is in
effect a "poor man's async" concept. In effect, it simulates concurrency.

> 'request = written' can be binary if only one byte is involved. If there
are
> more data, it depends on the medium. For serial ports and sockets, to name
> just two, it can be less than the entire data size. This is not Windows
> specific.

But again, and again and again, if you prepare the sync device, including
serial and sockets, for no timeouts, you will get a BLOCK.

On a READ, you will block 100%

On a WRITE, you will get SUCCESS or ERROR

Where is the timeout if I turned it off?

If I say READ and WRITE X bytes why will the system ignore the request
without an error?

> > I don't know how much simple it can get or why this is even a question.
>
> It is not. The concept is much older than WriteFile(). Have a look at
> _write(). As far as I can tell, it has not changed much since 1972 when
what
> later became known as the C Standard Library was created. And it may also
> complete _successfully_ upon writing _less_ than requested.

It depends on the platform. _write() will write what it can by the very
nature and purity of the function but depending on the platform and/or
device it will return an error.

Again, is is how you apply the design. You have to know the enviroment. A
write is a write. Under DOS, it will write what it can with the remaining
space, but FAIL if there is no space. Under Windows, _write uses
WriteFile(). It will ALWAYS return an error for a sync, no timeout device.

Just read with Windows _write docs says()

_write()

Return Value
If successful, _write returns the number of bytes actually written. If the
actual space remaining on the disk is less than the size of the buffer the
function is trying to write to the disk, _write fails and does not flush any
of the buffer’s contents to the disk. A return value of –1 indicates an
error. In this case, errno is set to one of two values: EBADF, which means
the file handle is invalid or the file is not opened for writing, or ENOSPC,
which means there is not enough space left on the device for the operation.

--
Hector Santos, Santronics Software, Inc.
http://www.santronics.com



.



Relevant Pages

  • Re: Process KeepAlive for any Pick variant?
    ... Good luck with that! ... I take it the timeout is OS based then? ... It's on windows, so I'm looking for a windows app that will let me specify ... then Accuterm DOES have a "Send Keepalives" checkbox - ...
    (comp.databases.pick)
  • Re: Need function like "raw_input", but with time limit
    ... >> an empty string when it gets no response. ... >sys.stdin, and it does provide timeout functionality, too. ... So, if you want to run on Windows, you ... If the user has entered data during this time, ...
    (comp.lang.python)
  • RE: Service Stop timeout setting
    ... AFAIK there is no way to dynamically change the timeout time which you ... specirfied at the time of windows starting up will be what is used until ... > will timeout and bring up an error message saying that the service isn't ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Power Management GPO?
    ... They are almost all Windows XP Pros, a couple Windows 2000 Pro but I'm not going to worry about them right now. ... I know that Microsoft set this up so that a standard User does not have rights to change the power settings and so far I have not been able to find a way to set them globally. ... EZ GPO sets the time outs for the User monitor timeout, System standby timeout and Hibernation timeout, but what about the other settings? ...
    (microsoft.public.windows.group_policy)
  • Re: One hour timeouts in Win2K?
    ... Microsoft MVP [Windows] ... | cycle I have a Sleep call, with a 2 second timeout. ... This works fine for many cycles, but at some point (after about ...
    (microsoft.public.win2000.general)

Loading