Article View: borland.public.cppbuilder.nativeapi
Article #4482Named Pipe... readable this time...
From: Duane A.
Date: Tue, 31 Jan 2006 17:59
Date: Tue, 31 Jan 2006 17:59
52 lines
2466 bytes
2466 bytes
Greetings all,
I'm trying to debug a recalcitrant C++Builder 6 app and had the
brainstorm of writing a separate pipe server task to receive/
log-to-file debug messages from it. Both programs would reside
on the same machine. I've tested the pipe server with a small
console based client app that successfully writes large amounts
of data, FAST. All appears fine on the server side. (The server
app is written in the "old-fashioned" WIN32 manner, as I'm that
kind of guy.)
I blithely thought that incorporating the client side into the
buggy app would be a snap, but... I can only perform a single
write into the pipe, using WriteFile(...) before it seems that I
never get another I/O event signalling that the write was
finished and the API is ready for another message.
Here's what the client send routine looks like...the setup of
the OVERLAPPED struct and creation of the event and existing
pipe file are done elsewhere. I tried to duplicate the logic of
the test client.
void TMyAppForm::WriteToPipe(char *pC)
{
unsigned long BytesWritten;
while(WaitForSingleObject(io.hEvent, 0) == WAIT_TIMEOUT)
Application->ProcessMessages();
ResetEvent(io.hEvent);
if(!WriteFile(hPipe, pC, strlen(pC), &BytesWritten, &io))
{
while(GetLastError() == ERROR_IO_PENDING)
Application->ProcessMessages();
}
}
Note that I'm a newbie to pipe IPC and am more familiar with M$
compiler environments.
Could the main message handler be "eating" my io events? I'm
stumped.
Thanks for any and all help,
Duane
Technical Details
Message-ID:
<43dfb397$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,f9f0f15011e4f8b1,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Duane A." <none@nowhere.com> Sender: "Duane A." <none@nowhere.com> Reply-To: "Duane A." <none@nowhere.com> Subject: Named Pipe... readable this time... Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 65.220.97.131 NNTP-Posting-Host: 207.105.83.66 Message-ID: <43dfb397$1@newsgroups.borland.com> Date: 31 Jan 2006 10:59:35 -0700 X-Trace: newsgroups.borland.com 1138733975 207.105.83.66 (31 Jan 2006 10:59:35 -0700) Lines: 54 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail