public SentOp SendRequest(CDSOperations Op, string TgtNode, byte[] Body) { if (CDSHandler.Alive) { SentOp ret = null; SendRequest(Op, TgtNode, Body, (SentOp s) => { ret = s; }); while (ret == null) System.Threading.Thread.Sleep(10); return ret; } else { throw new Exception("connection closed"); } }
public void SendRequest(CDSOperations Op, string TgtNode, byte[] Body, Reply OnReply) { if (CDSHandler.Alive) { int OpID = 0; foreach (SentOp o in SentOps) OpID = Math.Max(OpID, o.OpID + 1); SentOp NewSentOp = new SentOp() { OpID = OpID }; NewSentOp.OnReply += OnReply; SentOps.Add(NewSentOp); CDSHandler.SendMessage(ChannelID, (byte)Op, TgtNode, OpID, Body); } else { throw new Exception("connection closed"); } }