/// <summary> /// Constructor with TcpIpTarget</summary> /// <param name="target">TcpIpTarget</param> public TcpIpTransport(TcpIpTarget target) { DisconnectMessage = null; if (target == null) throw new ArgumentException("target is null"); IPAddress addr = null; if (!IPAddress.TryParse(target.IpAddress, out addr)) { try { IPHostEntry hostEntry = Dns.GetHostEntry(target.IpAddress); if (hostEntry.AddressList.Length > 0) addr = hostEntry.AddressList[0]; } catch { throw new ArgumentException("Invalid Host"); } } m_target = target; m_remoteEndPoint = new IPEndPoint(addr, (int)target.Port); ConnectTimeout = TimeSpan.MaxValue; // connectTimeout; m_transportEvent = new AutoResetEvent(false); // Create a TCP/IP socket for request/response m_commandSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); m_eventDataSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); }
public TcpIpTransport(TcpIpTarget target) { DisconnectMessage = null; if (target == null) { throw new ArgumentException("target is null"); } IPAddress addr = null; if (!IPAddress.TryParse(target.IpAddress, out addr)) { try { IPHostEntry hostEntry = Dns.GetHostEntry(target.IpAddress); if (hostEntry.AddressList.Length > 0) { addr = hostEntry.AddressList[0]; } } catch { throw new ArgumentException("Invalid Host"); } } m_target = target; m_remoteEndPoint = new IPEndPoint(addr, (int)target.Port); ConnectTimeout = TimeSpan.MaxValue; // connectTimeout; m_transportEvent = new AutoResetEvent(false); // Create a TCP/IP socket for request/response m_commandSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); m_eventDataSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); }
/// <summary> /// Constructor</summary> /// <param name="target">TCP/IP target being displayed</param> public TcpIpTargetEditDialogViewModel(TcpIpTarget target) { Title = "Edit TCP/IP Target".Localize(); Target = target; }