1 16 package net.sf.jftp.net; 17 18 import net.sf.jftp.system.logging.Log; 19 20 import java.io.*; 21 22 import java.net.*; 23 24 import java.util.*; 25 26 27 30 public class FtpServer extends Thread 31 { 32 private int port = 21; 33 private int dataPort = 20; 34 35 public FtpServer() 36 { 37 } 38 39 public FtpServer(int port) 40 { 41 this.port = port; 42 } 43 44 public void run() 45 { 46 try 47 { 48 ServerSocket listener = new ServerSocket(port); 49 50 while(true) 51 { 52 Socket s = listener.accept(); 53 new FtpServerSocket(s); 54 } 55 } 56 catch(IOException ioe) 57 { 58 Log.debug("ServerSocket error: " + ioe); 59 } 60 } 61 62 public static void main(String [] args) 63 { 64 FtpServer server = new FtpServer(2100); 65 server.start(); 66 } 67 } 68 | Popular Tags |