🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: NamedPipe problem

#3135
From: Remy Lebeau (TeamB)
Date: Thu, 17 Aug 2006 19:47
45 lines
2543 bytes
"mr. Burns" <mr._burns@web.de> wrote in message
news:44e4affa@newsgroups.borland.com...

> Up to now I did not really understand what the GetOverlappedResult()
> function is for. I just want to let read my client a certain No. of bytes
and
> if this is not finsihed e.g. in 20 seconds my program should show an error
> message. But in this 20 seconds I want to do something useful and not
> block my application.

Then I suggest you move your named pipe code into a worker thread.

> Lets say I use now the WaitForSingleObject() function. You said that
> the overlapped ReadFile function signals the event when reading is
finished.

Yes.

> Then I just have to code e.g. ShowMessage(InBuf) in the
> WAIT_OBJECT_0 case to catch the complete transmitted data,
> or not?

Yes.  But you still need to know how many bytes are actually in the buffer
in order to process it correctly.

> So for what now is the GetOverlappedResult()  function?

To know the number of bytes that were actually read.

> When do I have to call it?

When the overlapped operation has finished, and the event has been signaled.

> How many bytes maximum I can transmit using named pipes? Is there any
limit?

There is no limit.  However, WriteFile() will return the number of bytes
actually written each time, so that you can adjust your writing accordingly
if there is still pending data that needs to be written each time.  For
instance, if you are sending 100 bytes and only 50 are written, you have to
call WriteFile() again to send the remaining 50 bytes.


Gambit
Technical Details
Message-ID: <44e4c819@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <44e47a8e$1@newsgroups.borland.com> <44e4a098$1@newsgroups.borland.com> <44e4affa@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,facc6570cb7e9402
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <44e47a8e$1@newsgroups.borland.com> <44e4a098$1@newsgroups.borland.com> <44e4affa@newsgroups.borland.com>
Subject: Re: NamedPipe problem
Date: Thu, 17 Aug 2006 12:47:39 -0700
Lines: 47
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <44e4c819@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1155844121 68.69.17.41 (17 Aug 2006 12:48:41 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail