internal virtual FTPDataSocket NewPassiveDataSocket(string ipAddress, int port) { this.log.Debug(string.Concat(new object[] { "NewPassiveDataSocket(", ipAddress, ",", port, ")" })); IPEndPoint remoteEP = new IPEndPoint(IPAddress.Parse(ipAddress), port); BaseSocket sock = new StandardSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); try { this.SetSocketTimeout(sock, this.timeout); sock.Connect(remoteEP); } catch (Exception exception) { this.log.Error("Failed to create connecting socket", exception); sock.Close(); throw; } return new FTPPassiveDataSocket(sock); }
/// <summary> Constructs a new <code>FTPDataSocket</code> object (client mode) and connect /// to the given remote host and port number. /// /// </summary> /// <param name="ipAddress">IP Address to connect to. /// </param> /// <param name="port">Remote port to connect to. /// </param> /// <returns> A new <code>FTPDataSocket</code> object (client mode) which is /// connected to the given server. /// </returns> /// <throws> SystemException Thrown if no TCP/IP connection could be made. </throws> internal virtual FTPDataSocket NewPassiveDataSocket(string ipAddress, int port) { IPAddress ad = IPAddress.Parse(ipAddress); IPEndPoint ipe = new IPEndPoint(ad, port); BaseSocket sock = new StandardSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); SetSocketTimeout(sock, timeout); sock.Connect(ipe); return new FTPPassiveDataSocket(sock); }
/// <summary> Constructs a new <code>FTPDataSocket</code> object (client mode) and connect /// to the given remote host and port number. /// /// </summary> /// <param name="ipAddress">IP Address to connect to. /// </param> /// <param name="port">Remote port to connect to. /// </param> /// <returns> A new <code>FTPDataSocket</code> object (client mode) which is /// connected to the given server. /// </returns> /// <throws> SystemException Thrown if no TCP/IP connection could be made. </throws> internal virtual FTPDataSocket NewPassiveDataSocket(string ipAddress, int port) { log.Debug("NewPassiveDataSocket(" + ipAddress + "," + port + ")"); IPAddress ad = IPAddress.Parse(ipAddress); IPEndPoint ipe = new IPEndPoint(ad, port); BaseSocket sock = new StandardSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp, logTag); try { SetSocketTimeout(sock, timeout); sock.Connect(ipe, timeout); log.Debug("Connected"); } catch (Exception ex) { log.Error("Failed to create connecting socket", ex); sock.Close(); throw; } return new FTPPassiveDataSocket(sock); }