예제 #1
0
        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));
        }
예제 #2
0
        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);
            }
        }