
VB and COM ports and mscomm.vbx and hung PCs
I'm trying to write a more or less straightforward program that will let me
move bytes between two PCs through their serial ports and a null modem cable.
I'm having problems - one PC tends to lock up *hard* when I run it - hard
enough that Windows won't respond to cntrl-alt-del and I have to use the
reset button.
I believe I have the cabling and com port settings right - I can run Terminal
on each PC, with the respecting com ports set to 19200,8,n,1 and hardware
flow control, and when I type things on one, the other echos it properly.
For the folk who know the MSComm vbx, I'm using:
DTREnable True
Handshaking RTS
NullDiscard True
RThreshold 1
RTSEnable True
Settings 19200,n,8,1
InBufferSize 1024
OutBufferSize 2048
and everything else 0 or boring except CommPort, which is properly set.
If I run Terminal on one PC and my app on the other, they can usually
talk.
If I run my apps on both, one usually hangs, apparently immediately on
doing the OpenPort or the send of the first string.
I've evidence that if I run Terminal on one or both and then exit and run
my apps, they sometimes work, so I assume Terminal is setting something that
I'm not, and it helps. But if I exit my app and restart it, it instantly
hangs again.
I've used this vbx without problem when talking to a modem - it is
only talking over the cable to another PC (running the same copy of
the vbx) that I get the hang.
The project already involves a DLL written in C, so if I have to
I can try doing the serial I/O in C. But I was hoping to avoid
polling for characters - the vbx offers a VB event when it is time
to read data.
What causes a hard Windows 3.1 hang when opening a port or writing a byte?