[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Win32 WriteFile Limits (was: RE: Unsure as to what an error message is really telling me)

From: James Van Artsdalen <james_at_jrv.org>
Date: 2003-10-20 16:28:36 CEST

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/writefile.asp

The text I saw was

    Named pipe write operations across a network are limited to 65,535
    bytes.

The test case I wrote below was also helpful. The first WriteFile fails
and the second succeeds.

#include <wtypes.h>
#include <winbase.h>
#include <stdio.h>

int
main (int argc, char *argv[])
{
  char *buf = malloc (65536);
  int x, ret;
  HANDLE h;

  h = GetStdHandle (STD_OUTPUT_HANDLE);
  memset (buf, ' ', 65536);
  ret = WriteFile (h, buf, 65536, &x, 0);
  printf("WriteFile (65536) ret %d, err %d\n", ret, GetLastError ());
  ret = WriteFile (h, buf, 32768, &x, 0);
  printf("WriteFile (32768) ret %d, err %d\n", ret, GetLastError ());
}

> From: "Roger Lipscombe" <roger@differentpla.net>
> Date: Mon, 20 Oct 2003 09:36:24 +0100
>
> > The WriteFile () call in Windows is documented to fail in
> > some cases if more than 32 KB is written. This appear to be
> > another such case, either undocumented or a simple bug (I'm
> > running Windows XP SP1).
>
> Where's this documented? We had a problem with one of our products
> recently, and found a similar bug ourselves: WriteFile failed when writing
> 18Mb in one go (on Windows ME), but was OK with other sizes -- e.g. 1Mb or
> so. I'd be interested to know if the limits are documented anywhere.
>
> Thanks,
> Roger.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Oct 20 16:32:17 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.