Ejemplo n.º 1
0
        public void Write(string data)
        {
            byte[] bytes = ENCODING.GetBytes(data);
            bytes = BitStuffer.Encode(bytes);
            Int32 count = bytes.Length;

            senderPort.Write(bytes, 0, count);
        }
Ejemplo n.º 2
0
        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));
        }