🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #8029

Re: Missing data from network writes (Win2K client and server)

#8029
From: Andrue Cope [TeamB]
Date: Wed, 08 Dec 2004 16:54
102 lines
4194 bytes
A day spent investigating and I can confirm that when asked to write
65024 bytes you sometimes get less than that actually reaching the
remote destination. From that point on /no/ more data reaches the
destination.

WriteFile() never returns an error and always claims that it's writing
the number of bytes requested.

I added code to read the data back and compare it and that always
succeeds..even when the resulting file claims not to contain that data.

We have also found that earlier versions of our software do this.

Our conclusion after a day's investigation is that the network
requesters are simply failing to pass the data to the server. We are
investigating different versions of Windows now since the only reason
this can have remained hidden is that it's the result of a recent
service pack or update.

My own pet theory is that the requester has a queue for I/O requests
and we are eventually filling it and the requester doesn't report an
error or wait for the queue to empty. The only problem with this is
that we've boiled what we're doing down to a single function (see
below) and it doesn't exhibit this behaviour.

bool TForm1::diskIsGood()
{
  HANDLE outHandle=CreateFile("l:\\tmp.apc\\baddy",
                              GENERIC_READ|GENERIC_WRITE,
                              FILE_SHARE_READ,
                              NULL,
                              CREATE_ALWAYS,
                              0,
                              NULL);


     HANDLE fileHandle = CreateFile("\\\\.\\e:",
                                    GENERIC_READ|GENERIC_WRITE,
                                    FILE_SHARE_READ,
                                    NULL,
                                    OPEN_ALWAYS,
                                    0,
                                    NULL);

  BYTE buffer[ 65535 ];

  QWORD total=0;
  for( DWORD blockNumber=0;
       blockNumber<205000;
       blockNumber+=31 )
  {
    SetFilePointer( fileHandle,
                    blockNumber*DWORD( 2048 ),
                    NULL,
                    FILE_BEGIN );

    DWORD bytesRead=0;

    if( !ReadFile( fileHandle,
                  buffer,
                  2048*31,
                  &bytesRead,
                  NULL ) )
    {
      memset( buffer, '*', 2048*31 );
    }

  QWORD NewPosition=blockNumber*DWORD( 2048 );
  long  hi=long( NewPosition>>32 );
  long  lo=long( NewPosition&0xFFFFFFFF );

    SetFilePointer( outHandle,
                    lo,
                    &hi,
                    FILE_BEGIN );

    total+=2048*31;
    if( !WriteFile( outHandle,
                    buffer,
                    2048*31,
                    &bytesRead,
                    NULL ) )
      return false;

    Label1->Caption=General_StrComma( total );

    Application->ProcessMessages();
  }

  ShowMessage( General_StrComma( total ) );

  CloseHandle( outHandle );
  CloseHandle( fileHandle );

  return true;
}


-- 
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <41b731e9$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!213.73.255.4.MISMATCH!newsfeed.multikabel.nl!news2.euro.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41b6de1f$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,99122155c7605386
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Andrue Cope [TeamB]" <no.spam@not.a.valid.address>
Subject: Re: Missing data from network writes (Win2K client and server)
Newsgroups: borland.public.cppbuilder.nativeapi
References: <41b6de1f$1@newsgroups.borland.com>
Date: Wed, 8 Dec 2004 16:54:49 +0000
User-Agent: XanaNews/1.16.5.2
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 217.207.223.34
Message-ID: <41b731e9$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1102524905 217.207.223.34 (8 Dec 2004 08:55:05 -0800)
Lines: 102
X-Authenticated-User: acope
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!213.73.255.4.MISMATCH!newsfeed.multikabel.nl!news2.euro.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail