🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Comm Port kicking my butt

#3388
From: Bob Gonder
Date: Sun, 18 Jun 2006 19:31
36 lines
2150 bytes
JD wrote:

>The write seems to work because no errors are reported and the
>number of bytes written are correct. The read, OTOH reports
>nada - no errors and no data.

Are you sure that   throw ComException is working properly?
Do you have a sender attached to your comm port?
Is the cabling correct (null modem cable if computer-to-computer)?
Or proper loop-back?

>    FDCB.BaudRate  =        9600;
>    FDCB.ByteSize  =           8;
>    FDCB.Parity    =    NOPARITY;
>    FDCB.StopBits  =  ONESTOPBIT;
>    if( ! ::SetCommState(hCom, &FDCB) )

What about handshaking?
You don't set/reset Xon/off or DTR/DSR.
You might look into using BuildCommDCB

>    if( ! ::SetupComm(hCom, 1024*32, 1024*9) )

Those seem extra large.


>          DWORD nBytes;
>          AnsiString c = "Test String";
>          if( ! ::WriteFile( hCom, c.c_str(), c.Length(), &nBytes, NULL) )

Just a note of caution if you go back to overlapped....
If you return without waiting for completion, "c" goes away, and the
data being sent may get corrupted.
This will also work (without VCL):
	::WriteFile( hCom, "Test String", sizeof("Test String")-1,
			 &nBytes, NULL) )
Technical Details
Message-ID: <7i8b9217o7jvia753hmdt9l0i5gg0ib5sj@4ax.com>
Path: arc1-ca.pugleaf.net!g2news2.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: <44944ca9$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,5117e51131b9ac21
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Comm Port kicking my butt
Date: Sun, 18 Jun 2006 12:31:44 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <7i8b9217o7jvia753hmdt9l0i5gg0ib5sj@4ax.com>
References: <44944ca9$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.77.144.198
X-Trace: newsgroups.borland.com 1150659103 67.77.144.198 (18 Jun 2006 12:31:43 -0700)
Lines: 39
Path: arc1-ca.pugleaf.net!g2news2.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