Network Programming
// Write a node's address.
myComPort.Parity = Parity.Mark;
myComPort.Write("h");
// Delay as needed to ensure that the address has transmitted.
// Write data to the node.
myComPort.Parity = Parity.Space;
myComPort.WriteLine("Test data for node h.");
// Delay as needed to ensure that the data has transmitted.
// Write a node's address.
myComPort.Parity = Parity.Mark;
myComPort.Write("m");
// Delay as needed to ensure that the address has transmitted.
// Write data to the node.
myComPort.Parity = Parity.Space;
myComPort.WriteLine("Test data for node m.");
When a byte with a parity error is the next byte to be read from the port, the
ErrorReceived event fires with an EventType of SerialError.RXParity. Chapter
10 showed how to assign a method to the ErrorReceived event.
A computer receiving data waits for a parity error and then reads the byte with
the error. If the byte matches the node’s address, the application accepts and
uses all data that follows until the next parity error. If a byte with a parity error
doesn’t match the node’s address, the application reads all data that follows up
to the next parity error but doesn’t use the data in any other way.