public void Write(string data) { byte[] bytes = ENCODING.GetBytes(data); bytes = BitStuffer.Encode(bytes); Int32 count = bytes.Length; senderPort.Write(bytes, 0, count); }
public string Read() { byte[] buffer = new byte[BUFFER_SIZE]; Int32 offset = 0; Int32 count = BUFFER_SIZE; int readbytes; try { readbytes = receiverPort.Read(buffer, offset, count); buffer = BitStuffer.Decode(buffer); } catch (TimeoutException) { } return(ENCODING.GetString(buffer)); }