Article View: borland.public.cppbuilder.nativeapi
Article #4384Named pipe conundrum
From: Duane A.
Date: Tue, 31 Jan 2006 17:57
Date: Tue, 31 Jan 2006 17:57
31 lines
2409 bytes
2409 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:
<43dfb314$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,35d51da2ca244c26,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 conundrum Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 65.220.97.131 NNTP-Posting-Host: 207.105.83.66 Message-ID: <43dfb314$1@newsgroups.borland.com> Date: 31 Jan 2006 10:57:24 -0700 X-Trace: newsgroups.borland.com 1138733844 207.105.83.66 (31 Jan 2006 10:57:24 -0700) Lines: 33 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