Hi,
I wonder if anyone can help. I am using VB.NET to read (and send) data to/from a TCP server. This server allows me to sniff/insert data onto physical RS232 data lines. However, what it does not do is strip / insert the parity bit for me.
This means that initially, the string I read from incoming data to my socket is decoded incorectly if the parity bit is set. For example, when I am using even parity, the character '1' is represented on the data lines by:
MSB...10110001...LSB
Where the MSB is my even parity bit. However, initially this is decoded as a member of the extended ascii set, character "±" (any characters with zero parity bit decoded OK of course, since the MSB was not set)
By initial solution was to convert the received string into a byte array, then loop through every element of that array and AND the byte with 127, which in binary is:
01111111
This should change any set 8th bits to 0, and so when I then convert the byte array back to a string I should have the correct characters...but it seems not to be working.
Any thoughts?
I wonder if anyone can help. I am using VB.NET to read (and send) data to/from a TCP server. This server allows me to sniff/insert data onto physical RS232 data lines. However, what it does not do is strip / insert the parity bit for me.
This means that initially, the string I read from incoming data to my socket is decoded incorectly if the parity bit is set. For example, when I am using even parity, the character '1' is represented on the data lines by:
MSB...10110001...LSB
Where the MSB is my even parity bit. However, initially this is decoded as a member of the extended ascii set, character "±" (any characters with zero parity bit decoded OK of course, since the MSB was not set)
By initial solution was to convert the received string into a byte array, then loop through every element of that array and AND the byte with 127, which in binary is:
01111111
This should change any set 8th bits to 0, and so when I then convert the byte array back to a string I should have the correct characters...but it seems not to be working.
Any thoughts?