예제 #1
0
        /// Return the next message sent by the receiver, or, after
        /// <paramref name="timeout"/> has passed, return <c>null</c>.
        public virtual byte[] Get(double timeout = 0.1)
        {
            EnsureSocketConnected();

            int microsecondTimeout = (int)(timeout * 1000000);

            if (commandSocket.Poll(microsecondTimeout, SelectMode.SelectRead))
            {
                byte[] headerBytes = new byte[16];
                commandSocket.Receive(headerBytes);

                Header header = EiscpPacket.ParseHeader(headerBytes);

                byte[] message = new byte[header.messageSize];
                commandSocket.Receive(message);

                return(IscpMessage.Parse(message));
            }

            return(null);
        }
예제 #2
0
 public EiscpPacket(IscpMessage iscpMessage)
     : this(iscpMessage.Bytes)
 {
 }
예제 #3
0
 public EiscpPacket(IscpMessage iscpMessage) :
     this(iscpMessage.Bytes)
 {
 }