public void rxSubroutine() {
while (commsActive) {
// for serial based comms
if (commsMode == c_Mode_t.serial_comms) {
} // if
// For IP based comms
else if (commsMode == c_Mode_t.ip_comms) {
// read a character.
bytesRead = TCPConnection.Receive(rawRxBytes, totalBytesRead, 128, SocketFlags.None, out err);
totalBytesRead += bytesRead;
if (SocketError.Success == err) {
if (bytesRead > 0) {
rxStarted = true;
} // if
} // if
else if (SocketError.WouldBlock != err) {
if (rxStarted) {
rxStarted = false; //break point placed here totalBytesRead = 0; } // else
return;
} // else if
} // else if
Thread.Sleep(10);
} // while
} // rxSubroutine
|