public static Message<ReleaseRequest> ReadReleaseRequest(NetworkBinaryReader dr) { var relReq = new ReleaseRequest(); if (relReq.Write().Skip(1).SequenceEqual(dr.Take(9))) { return new Message<ReleaseRequest> { Payload = relReq, Type = MessageType.PDU }; } //Invalid release request throw new Exception("Release request was invalid. Did not match signature."); }
public static void SendReleaseRequest(Association asc) { var req = new ReleaseRequest(); asc.State = NetworkState.AWAITING_RELEASE_RESPONSE; asc.Logger.Log("-->" + req); byte[] message = req.Write(); if ( asc.Stream.CanWrite) { asc.Stream.Write(message, 0, message.Length); } }