using System.Net; using DotNext; namespace Peripherals.OscilloscopeClient; static class OscilloscopeAddr { public const UInt32 Base = 0x0000_0000; } class Oscilloscope { private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); readonly int timeout = 2000; readonly int port; readonly string address; private IPEndPoint ep; /// /// 初始化示波器客户端 /// /// 示波器设备IP地址 /// 示波器设备端口 /// 超时时间(毫秒) public Oscilloscope(string address, int port, int timeout = 2000) { if (timeout < 0) throw new ArgumentException("Timeout couldn't be negative", nameof(timeout)); this.address = address; this.port = port; this.ep = new IPEndPoint(IPAddress.Parse(address), port); this.timeout = timeout; } }