Example #1
0
        public override int ReadData(DuplexStream stream)
        {
            base.ReadData(stream);
            int result;

            try
            {
                this.UID        = stream.ReadBytes((int)DiscoverResponsePacket.UID_SIZE);
                this.PortMask   = stream.ReadByte();
                this.IpAddress  = stream.ReadInt32();
                this.PortNumber = stream.ReadByte();
            }
            catch (Exception ex)
            {
                Log.Write(ex);
                result = -1;
                return(result);
            }
            result = 0;
            return(result);
        }
        public override int ReadData(DuplexStream stream)
        {
            base.ReadData(stream);
            int result;

            try
            {
                this.Result = stream.ReadByte();
            }
            catch (Exception ex)
            {
                Log.Write(ex);
                result = -1;
                return(result);
            }
            result = 0;
            return(result);
        }
Example #3
0
        public virtual int ReadHeader(DuplexStream stream)
        {
            int result;

            try
            {
                this.Header   = stream.ReadBytes((int)Packet.HEADER_SIZE);
                this.Type     = stream.ReadInt16();
                this.DataSize = stream.ReadByte();
            }
            catch (Exception ex)
            {
                Log.Write(ex);
                result = -1;
                return(result);
            }
            result = 0;
            return(result);
        }