public string getMessage() { byte[] array = null; int num = 0; TLQMSG_INFO tLQMSG_INFO = default(TLQMSG_INFO); TLQMSG_OPT tLQMSG_OPT = default(TLQMSG_OPT); TLQError tLQError = default(TLQError); TLQInterface.Tlq_InitMsgInfo(ref tLQMSG_INFO); TLQInterface.Tlq_InitMsgOpt(ref tLQMSG_OPT); tLQMSG_OPT.AckMode = 1; tLQMSG_OPT.WaitInterval = this.pWaitInterval; tLQMSG_OPT.QueName = this.rcvQueName; while (true) { int num2 = TLQInterface.Tlq_GetMsg(ref this.gid, ref this.qcuId, ref tLQMSG_INFO, ref tLQMSG_OPT, ref array, ref tLQError); bool flag = num2 < 0; if (!flag) { goto IL_C8; } num++; bool flag2 = num > 3; if (flag2) { break; } num2 = this.GetProcByTLQError(ref tLQError); bool flag3 = num2 == 1; if (flag3) { num2 = this.ReConnectToTLQ(); } else { bool flag4 = num2 == 2; if (!flag4) { goto IL_C7; } } } throw new Exception("Get message faild.Error:" + tLQError.errstr); IL_C7: IL_C8: string result = string.Empty; bool flag5 = array != null; if (flag5) { result = encoding.GetString(array); } return(result); }
private void receiveData(SDKClient.IReceiver messageListener) { int num = 0; TLQError tLQError = default(TLQError); TLQMSG_INFO tLQMSG_INFO = default(TLQMSG_INFO); TLQMSG_OPT tLQMSG_OPT = default(TLQMSG_OPT); while (true) { byte[] bytes = null; TLQInterface.Tlq_InitMsgInfo(ref tLQMSG_INFO); TLQInterface.Tlq_InitMsgOpt(ref tLQMSG_OPT); tLQMSG_INFO.Persistence = 1; tLQMSG_OPT.QueName = this.rcvQueName; tLQMSG_OPT.AckMode = 1; tLQMSG_OPT.WaitInterval = this.pWaitInterval; while (true) { this.ret = TLQInterface.Tlq_GetMsg(ref this.gid, ref this.qcuId, ref tLQMSG_INFO, ref tLQMSG_OPT, ref bytes, ref tLQError); bool flag = this.ret < 0; if (!flag) { goto IL_FA; } num++; bool flag2 = num > 3; if (flag2) { goto Block_2; } this.ret = this.GetProcByTLQError(ref tLQError); bool flag3 = this.ret == 1; if (flag3) { this.ret = this.ReConnectToTLQ(); } else { bool flag4 = this.ret == 2; if (!flag4) { break; } } } continue; IL_FA: string @string = encoding.GetString(bytes); messageListener.receiveData(@string); } Block_2: throw new Exception("Receive message faild.Error:" + tLQError.errstr); }