Still trying to determine the number of bytes available at a given serial port.
I have 2 PCs connected to a piece of hardware (an alarm system.) Hardware responds to commands from one PC only.
One PC is the Master and the other (others) is the Slave. The Master sends a 1 byte command to the hardware and the hardware responds with between 1 and 384 bytes depending on the command it received.
The Slave is read only and cannot send commands to the hardware.
These 3 devices are connected with a simple RS232 network where the TX lines for each PC are diode protected.
This all works properly until the hardware (or the Master) is offline.
My issue is that I need to determine if there are any bytes at the Slave's serial port (or the Master's serial port.)
For Master...
Code: Select all
If LOC(1) > 0 Then
Get #1, , buffer, bytesRead
Else
doErrorRoutine
End If
When Slave attempts a Get while hardware is offline/not transmitting, the program locks up. It will unlock when the hardware starts transmitting.
(Single Thread application.)
How else can the number of bytes available at the Slaves serial port be determined?