private static TcpClient OpenSocket(FtpConnectionObject connectionObject) { TcpClient socketPasv = connectionObject.PasvSocket; if (socketPasv != null) { connectionObject.PasvSocket = null; return(socketPasv); } return(SocketHelpers.CreateTcpClient(connectionObject.PortCommandSocketAddress, connectionObject.PortCommandSocketPort)); }
private static TcpClient OpenSocket(FtpConnectionObject connectionObject) { switch (connectionObject.DataConnectionType) { case DataConnectionType.Active: return(SocketHelpers.CreateTcpClient(connectionObject.PortCommandSocketAddress, connectionObject.PortCommandSocketPort)); case DataConnectionType.Passive: return(connectionObject.PassiveSocket); default: FtpServerMessageHandler.SendMessage(connectionObject.Id, "Invalid connection type!"); return(null); } }