001 /* 002 * ftp4j - A pure Java FTP client library 003 * 004 * Copyright (C) 2008-2009 Carlo Pelliccia (www.sauronsoftware.it) 005 * 006 * This program is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU Lesser General Public License version 008 * 2.1, as published by the Free Software Foundation. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License version 2.1 along with this program. 017 * If not, see <http://www.gnu.org/licenses/>. 018 */ 019 package it.sauronsoftware.ftp4j.connectors; 020 021 import it.sauronsoftware.ftp4j.FTPConnection; 022 import it.sauronsoftware.ftp4j.FTPConnector; 023 024 import java.io.IOException; 025 import java.net.Socket; 026 027 /** 028 * The DirectConnector connects the remote host with a straight socket 029 * connection, using no proxy. 030 * 031 * @author Carlo Pelliccia 032 */ 033 public class DirectConnector implements FTPConnector { 034 035 private FTPConnection connect(String host, int port) throws IOException { 036 Socket socket = new Socket(host, port); 037 return new SocketConnection(socket); 038 } 039 040 public FTPConnection connectForCommunicationChannel(String host, int port) 041 throws IOException { 042 return connect(host, port); 043 } 044 045 public FTPConnection connectForDataTransferChannel(String host, int port) 046 throws IOException { 047 return connect(host, port); 048 } 049 050 }