예제 #1
0
        public static byte[] RemoveBznRequest(string[] icpDevices)
        {
            AosBody   aosBody   = new AosBody(ToByteArray(icpDevices));
            AosHeader aosHeader = new AosHeader(ProtocolTypeEnum.RemoveBzn, aosBody.Length);

            return(aosHeader.ToByteArray().Concat(aosBody.ToByteArray()).ToArray());
        }
예제 #2
0
        private void ReceiveBodyCallback(IAsyncResult ar)
        {
            try
            {
                SocketStateObject bodyState = (SocketStateObject)ar.AsyncState;
                Socket            client    = bodyState.socket;

                int     bytesRead = client.EndReceive(ar);
                AosBody aosBody   = AosBody.ToAosBody(bodyState.buffer);

                AosBodyReceivedEvent?.Invoke(this, new AosBodyEventArgs(aosBody));

                SocketStateObject headerState = new SocketStateObject(AosHeader.Length);
                headerState.socket = client;

                var sync = client.BeginReceive(headerState.buffer, 0, headerState.bufferSize, 0, new AsyncCallback(ReceiveHeaderCallback), headerState);
                //sync.AsyncWaitHandle.WaitOne();
            }
            catch (Exception ex)
            {
                logger.Error(ex, $"Can't recieve data");
            }
        }
예제 #3
0
 public AosBodyEventArgs(AosBody request)
 {
     Request = request;
 }