public static bool ResNtyLoginOut(byte[] data, ref NtyLoginOut nlo) { CS_RES_MSG msg = PBConverter.Deserialize <CS_RES_MSG>(data); if (msg.Msgid == MSGID.CsNtyLoginoutId) { CS_NTY_LOGINOUT resMsg = msg.CsNtyLoginout; nlo.uid = resMsg.Id; nlo.reason = (int)resMsg.Reason; return(true); } return(false); }
private async Task AsyncReceiveNty() { await Task.Run(() => { while (true) { byte[] data = new byte[1024]; ReceiveData(ref data); NtyLoginOut nlo = new NtyLoginOut(); bool isNty = PBConverter.ResNtyLoginOut(data, ref nlo); if (isNty == true) { //打断主进程 Console.WriteLine("this is nty"); break; } Console.WriteLine("no Nty"); } }); }