/// <summary> /// 从服务端读信息 /// </summary> /// <param name="asc">ASCII字符串</param> /// <param name="hex">16进制格式字符串</param> public void Read(out string asc, out string hex) { asc = hex = string.Empty; if (BaseClient == null || BaseClient.Available == 0) { return; } try { byte[] data = BaseClient.Receive(ref remote_endpoint); Events.DataReceivedEventArgs args = new Events.DataReceivedEventArgs(data); asc = args.ReceivedInfo_String; hex = args.ReceivedInfo_HexString; } catch (Exception) { } }
/// <summary> /// 从服务端读信息 /// </summary> /// <param name="asc">ASCII字符串</param> /// <param name="hex">16进制格式字符串</param> public void Read(out string asc, out string hex) { asc = hex = string.Empty; int available; if (BaseClient == null || (available = BaseClient.Available) == 0) { return; } try { NetStream.Read(Buffer, 0, available); Events.DataReceivedEventArgs args = new Events.DataReceivedEventArgs(Buffer); asc = args.ReceivedInfo_String; hex = args.ReceivedInfo_HexString; } catch (Exception) { } }