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()); }
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"); } }
public AosBodyEventArgs(AosBody request) { Request = request; }