🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: NamedPipe problem

#3137
From: Remy Lebeau (TeamB)
Date: Fri, 18 Aug 2006 07:38
36 lines
2307 bytes
"T. Meyer" <timon@mustek.de> wrote in message
news:44e56623$1@newsgroups.borland.com...

> Using FILE_FLAG_OVERLAPPED does not solve my
> problem, still I get The handle is invalid on reading from pipe :-(

Then you are still not doing something correctly.  What does the code look
like on the server side?  Did you create the pipe in full duplex mode?  You
probably have a mismatch in flags being used on both ends of the pipe.

> Just to get it right the event is signaled if an amount of bytes
> were sent, but there can be still bytes to send left?

Yes.

> E.g. the server wants to send 100 bytes, my client receives 40 bytes
> and singnals the event, then I have to call GetOverlappedResult to see
> that only 40 bytes were tranmsitted?

Yes.  If the pipe mode is set to PIPE_TYPE_BYTE, then ReadFile() will return
as many bytes as are available on the pipe, up to the specified count.  If
the pipe mode is set to PIPE_TYPE_MESSAGE, on the other hand, then
ReadFile() will fail if the requested count is smaller then the sent
message.  GetLastError() will then return ERROR_MORE_DATA.

> How to I get the rest 60 bytes?

Call ReadFile() again, specifying the remaining number of bytes.

> Still wait the next evt signaled

You have to call ReadFile() first to start a new overlapped operation.


Gambit
Technical Details
Message-ID: <44e56eb5$2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <44e47a8e$1@newsgroups.borland.com> <44e4a098$1@newsgroups.borland.com> <44e4affa@newsgroups.borland.com> <44e4c819@newsgroups.borland.com> <44e56623$1@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> <44e4c819@newsgroups.borland.com> <44e56623$1@newsgroups.borland.com>
Subject: Re: NamedPipe problem
Date: Fri, 18 Aug 2006 00:38:13 -0700
Lines: 39
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: <44e56eb5$2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1155886773 68.69.17.41 (18 Aug 2006 00:39:33 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail