private static void ReceiveMsg() { while (isOn) { // 用来保存发送方的ip和端口号 EndPoint point = new IPEndPoint(IPAddress.Any, 0); byte[] buffer = new byte[1024]; // 接收数据报 try { int length = socket.ReceiveFrom(buffer, ref point); Cat021Data outData = CommWrapper.decode(buffer, UDPDataSource.type); qData.Enqueue(outData); } catch (Exception) { return; } } }