亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ftpclient.java

?? 實例45 選擇字體 126 實例46 UDP與TCP/IP的簡單應用 129 實例47 聊天室 131 實例48 瀏覽FTP 136 實例49 局域網廣播 14
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
      portSocket.close();
	   }//end of port transfer

        return dataSocket;     // return the dataSocket
    }


    /** open a FTP connection to host <i>host</i>. */
    public void openServer(String host) throws IOException, UnknownHostException {
        int port = FTP_PORT;
        if (serverSocket != null)
            closeServer(); 
        serverSocket = new Socket(host, FTP_PORT);    
        serverOutput = new PrintWriter(new BufferedOutputStream(serverSocket.getOutputStream()),true);
        serverInput = new BufferedInputStream(serverSocket.getInputStream());
    }

    /** open a FTP connection to host <i>host</i> on port <i>port</i>. */
    public void openServer(String host, int port) throws IOException, UnknownHostException {
        if (serverSocket != null)
            closeServer();
        serverSocket = new Socket(host, port);
        //serverSocket.setSoLinger(true,30000);
        serverOutput = new PrintWriter(new BufferedOutputStream(serverSocket.getOutputStream()),
                                       true);
        serverInput = new BufferedInputStream(serverSocket.getInputStream());

        if (readReply() == FTP_ERROR)
            throw new FtpConnectException("Welcome message");
    }


    /** 
     * login user to a host with username <i>user</i> and password 
     * <i>password</i> 
     */
    public void login(String user, String password) throws IOException {
       
        if (!serverIsOpen())
            throw new FtpLoginException("Error: not connected to host.\n");
        this.user = user;
        this.password = password;
        if (issueCommand("USER " + user) == FTP_ERROR)
            throw new FtpLoginException("Error: User not found.\n");
        if (password != null && issueCommand("PASS " + password) == FTP_ERROR)
            throw new FtpLoginException("Error: Wrong Password.\n");       
    }

    /** 
     * login user to a host with username <i>user</i> and no password 
     * such as HP server which uses the form "<username>/<password>,user.<group>
     */
    public void login(String user) throws IOException {

        if (!serverIsOpen())
            throw new FtpLoginException("not connected to host");
        this.user = user;        
        if (issueCommand("USER " + user) == FTP_ERROR)
            throw new FtpLoginException("Error: Invalid Username.\n");                 
    }

    /** GET a file from the FTP server in Ascii mode*/
    public BufferedReader getAscii(String filename) throws IOException {     
        Socket  s = null;
        try {
            s = openDataConnection("RETR " + filename);
        } catch (FileNotFoundException fileException) {fileException.printStackTrace();}
        return new BufferedReader( new InputStreamReader(s.getInputStream()));          
    }

    /** GET a file from the FTP server in Binary mode*/
    public BufferedInputStream getBinary(String filename) throws IOException {     
        Socket  s = null;
        try {
            s = openDataConnection("RETR " + filename);
        } catch (FileNotFoundException fileException) {fileException.printStackTrace();}
        return new BufferedInputStream(s.getInputStream());          
    }


    /** PUT a file to the FTP server in Ascii mode*/
    public BufferedWriter putAscii(String filename) throws IOException {
        Socket s = openDataConnection("STOR " + filename);
        return new BufferedWriter(new OutputStreamWriter(s.getOutputStream()),4096);
    }
     
    /** PUT a file to the FTP server in Binary mode*/
    public BufferedOutputStream putBinary(String filename) throws IOException {
        Socket s = openDataConnection("STOR " + filename);
        return new BufferedOutputStream(s.getOutputStream());
    }

    /** APPEND (with create) to a file to the FTP server in Ascii mode*/
    public BufferedWriter appendAscii(String filename) throws IOException {
        Socket s = openDataConnection("APPE " + filename);
        return new BufferedWriter(new OutputStreamWriter(s.getOutputStream()),4096);
    }

    /** APPEND (with create) to a file to the FTP server in Binary mode*/
    public BufferedOutputStream appendBinary(String filename) throws IOException {
        Socket s = openDataConnection("APPE " + filename);
        return new BufferedOutputStream(s.getOutputStream());
    }



   /** NLIST files on a remote FTP server */
    public BufferedReader nlist() throws IOException {
        Socket s = openDataConnection("NLST");        
        return new BufferedReader( new InputStreamReader(s.getInputStream()));
    }

    /** LIST files on a remote FTP server */
    public BufferedReader list() throws IOException {
        Socket s = openDataConnection("LIST");        
        return new BufferedReader( new InputStreamReader(s.getInputStream()));
    }

    /** CD to a specific directory on a remote FTP server */
    public void cd(String remoteDirectory) throws IOException {
        issueCommandCheck("CWD " + remoteDirectory);
    }

    /** Rename a file on the remote server */
    public void rename(String oldFile, String newFile) throws IOException {
         issueCommandCheck("RNFR " + oldFile);
         issueCommandCheck("RNTO " + newFile);
    }
      
    /** Site Command */ 
    public void site(String params) throws IOException {
         issueCommandCheck("SITE "+ params);
    }            
	
    /** Set transfer type to 'I' */
    public void binary() throws IOException {
        issueCommandCheck("TYPE I");
        binaryMode = true;
    }

    /** Set transfer type to 'A' */
    public void ascii() throws IOException {
        issueCommandCheck("TYPE A");
        binaryMode = false;
    }

    /** Send Abort command */
    public void abort() throws IOException {
        issueCommandCheck("ABOR");
    }

    /** Go up one directory on remots system */
    public void cdup() throws IOException {
        issueCommandCheck("CDUP");
    }

    /** Create a directory on the remote system */
    public void mkdir(String s) throws IOException {
        issueCommandCheck("MKD " + s);
    }

    /** Delete the specified directory from the ftp file system */
    public void rmdir(String s) throws IOException {
        issueCommandCheck("RMD " + s);
    }

    /** Delete the file s from the ftp file system */
    public void delete(String s) throws IOException {
        issueCommandCheck("DELE " + s);
    }

    /** Get the name of the present working directory on the ftp file system */
    public void pwd() throws IOException {
        issueCommandCheck("PWD");
    }
    
    /** Retrieve the system type from the remote server */
    public void syst() throws IOException {
        issueCommandCheck("SYST");
    }


    /** New FTP client connected to host <i>host</i>. */
    public FtpClient(String host) throws IOException {      
        openServer(host, FTP_PORT);      
    }

    /** New FTP client connected to host <i>host</i>, port <i>port</i>. */
    public FtpClient(String host, int port) throws IOException {
        openServer(host, port);
    }
    
    /** Method to demonstrate use of FtpClient class */

    public static void main (String args []) throws IOException{
      System.out.println("Demo of FtpClient class.\n");

      // standard login procedures, must be done on all ftp servers 

      FtpClient f = new FtpClient("ftp.sun.com");

      System.out.print(f.getResponseString());

      f.login("anonymous","me@abc.com");
      System.out.print(f.getResponseString());
                        
      f.pwd(); 
      System.out.println(f.command);                  
      System.out.print(f.getResponseString());

      f.setPassive(true);

      // here's how you can do a listing

      System.out.println("\nDemo of nlist() function");

      f.ascii();  // set client to ascii mode to get text listing   
      System.out.println(f.command);              
      System.out.print(f.getResponseString());
          
      BufferedReader t = f.nlist();     // f.list gives a few more details
      System.out.println(f.command);
      System.out.print(f.getResponseString());  
      while( true ) {
         String stringBuffer = t.readLine();
         if( stringBuffer == null ) break;
         else System.out.println(stringBuffer);               
      }
      t.close();
      System.out.print(f.getResponseString());  
      // here's how to get a file using the getAscii() function.  The getBinary() function is similar in use  
      
      System.out.println("\nDemo of getAscii() function");

      f.ascii();           //  set transfer mode to ASCII, it has to be done by the user.
      System.out.println(f.command);
      System.out.print(f.getResponseString());  
      BufferedReader bufGet = f.getAscii("welcome.msg");
      System.out.println(f.command);      
      System.out.print(f.getResponseString());      
      PrintWriter pOut = new PrintWriter(new BufferedWriter(new FileWriter("welcome.msg")));
      int i;                                
      char c[] = new char[4096];
      while ((i = bufGet.read(c)) != -1) 
        pOut.write(c,0,i);                                                   
      bufGet.close();
      pOut.close();            
        
      System.out.print(f.getResponseString());     

      
      // here's how to APPEND an ASCII file using the appendAscii() function.  The appendBinary() function
      // is similar in use.  I am leaving this code commented out because you can't send files to the 
      // sun ftp site but you can try this on another ftp server
    
	/*
      System.out.println("\nDemo of appendAscii() function");
      BufferedWriter bufAppe;
      String localFile = "file name goes here"; 
      f.ascii();
      System.out.println(f.command);
      try {
      bufAppe = f.appendAscii(localFile);
      System.out.println(f.command);
      System.out.print(f.getResponseString());     
      
	FileReader fIn = new FileReader(localFile);            
      BufferedReader bufIn = new BufferedReader(fIn);
      int k;
      char b[] = new char[1024];
      while ((k = bufIn.read(b)) != -1) 
        bufAppe.write(b,0,k);                                  
      bufIn.close();
      bufAppe.flush();
      bufAppe.close();                 
      }catch(Exception appendErr) {
         System.out.println(appendErr.toString());//printStackTrace();
         
        }

      System.out.print(f.getResponseString()); 
	


      // here's how to send a binary file using the putBianary() function.  The putAscii() function
      // is similar in use.  I am leaving this code commented out because you can't send files to the 
      // sun ftp site but you can try this on another ftp server
    

      System.out.println("\nDemo of putBinary() function");
 
      String localFile = "file name goes here"; 
      f.binary();
      System.out.println(f.command);
      BufferedOutputStream bufPut = f.putBinary(localFile);
      System.out.println(f.command);
      System.out.print(f.getResponseString());     
      BufferedInputStream bufIn = new BufferedInputStream(new FileInputStream(localFile));
      int j;
      byte b[] = new byte[1024];
      while ((j = bufIn.read(b)) != -1) 
        bufPut.write(b,0,j);                                  
      bufIn.close();
      bufPut.flush();
      bufPut.close();                 

      System.out.print(f.getResponseString()); 
*/
      // close the connection

      f.closeServer();
      System.out.println(f.command);
      System.out.print(f.getResponseString());
    }


}

class FtpLoginException extends FtpProtocolException {
    FtpLoginException(String s) {
        super(s);
    }
}
class FtpConnectException extends FtpProtocolException {
    FtpConnectException(String s) {
        super(s);
    }
}

class FtpProtocolException extends IOException {
    FtpProtocolException(String s) {
        super(s);     
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91福利视频在线| 欧美精品一区二区在线播放| 91麻豆精品国产91久久久更新时间| 日韩欧美国产不卡| 伊人婷婷欧美激情| 成人妖精视频yjsp地址| 欧美色偷偷大香| 国产精品久久毛片a| 激情文学综合网| 欧美精品精品一区| 亚洲黄色小说网站| av高清久久久| 欧美韩日一区二区三区四区| 午夜视频一区二区| 在线观看三级视频欧美| 一本到不卡精品视频在线观看| 亚洲欧美综合色| 日韩一区精品视频| 91麻豆swag| 日韩美女视频19| 波多野结衣中文字幕一区二区三区| 欧美成人猛片aaaaaaa| 午夜国产不卡在线观看视频| 91啪九色porn原创视频在线观看| 国产亚洲1区2区3区| 激情av综合网| 久久综合九色综合97婷婷| 欧美bbbbb| 日韩一区二区中文字幕| 男男成人高潮片免费网站| 欧美日韩视频在线一区二区| 亚洲在线视频一区| 欧美亚洲国产bt| 亚洲制服欧美中文字幕中文字幕| 91麻豆精品在线观看| 国产精品免费看片| 国产精品久久三区| 日本福利一区二区| 精品日韩99亚洲| 久久精品av麻豆的观看方式| 日韩美女一区二区三区四区| 蜜桃视频一区二区三区| 精品成人a区在线观看| 国产最新精品免费| 国产精品久久久99| 欧美图区在线视频| 日本女优在线视频一区二区| 欧美成人a视频| 大美女一区二区三区| 亚洲欧洲一区二区三区| 色婷婷久久久综合中文字幕| 亚洲高清免费一级二级三级| 日韩手机在线导航| 国产不卡视频在线观看| 亚洲图片另类小说| 欧美精品v国产精品v日韩精品| 免费成人深夜小野草| 日本一区二区三区国色天香| 91在线观看下载| 精品在线播放免费| 国产高清精品在线| 亚洲精品一区二区三区在线观看| 国产剧情一区二区| 又紧又大又爽精品一区二区| 欧美二区在线观看| 成人午夜视频福利| 婷婷久久综合九色国产成人 | 欧美年轻男男videosbes| 五月天丁香久久| 久久精品一区四区| 在线观看亚洲a| 国产精品自拍av| 亚洲午夜av在线| 国产精品视频九色porn| 欧美久久久久久久久中文字幕| 国产精品伊人色| 图片区小说区区亚洲影院| 国产清纯白嫩初高生在线观看91 | 亚洲视频一区在线| 日韩欧美中文字幕制服| 99久久精品免费精品国产| 免费成人av在线播放| 亚洲人成小说网站色在线 | 日韩成人精品在线观看| 国产精品视频线看| 2021国产精品久久精品| 欧美日韩国产免费一区二区| 成人黄色电影在线| 黄一区二区三区| 青青青爽久久午夜综合久久午夜| 最新国产の精品合集bt伙计| 久久精品视频一区二区三区| 欧美日韩色综合| 色婷婷综合激情| av亚洲精华国产精华精华| 国产伦精品一区二区三区免费 | 美女性感视频久久| 亚洲午夜激情网站| 一区二区理论电影在线观看| 欧美激情艳妇裸体舞| 久久久亚洲精品石原莉奈| 在线播放日韩导航| 亚洲激情第一区| 久久欧美中文字幕| 色婷婷av一区二区三区之一色屋| 欧美日韩在线综合| 蜜桃视频一区二区| 三级在线观看一区二区| 亚洲成人一区二区在线观看| 亚洲欧洲日韩一区二区三区| 久久九九影视网| 中文字幕av一区二区三区免费看 | 欧美丝袜第三区| 一本在线高清不卡dvd| 一本大道综合伊人精品热热| 91在线观看一区二区| 色香色香欲天天天影视综合网| xf在线a精品一区二区视频网站| 3atv在线一区二区三区| 91麻豆精品国产| 欧美一区二区三区婷婷月色| 欧美一级片在线| 国产欧美一区二区在线| 2021久久国产精品不只是精品| 99国产精品久久| 91影视在线播放| 在线观看国产一区二区| 在线观看免费亚洲| 欧美精品xxxxbbbb| 欧美精品一区在线观看| 久久精品视频网| 亚洲精品ww久久久久久p站| 亚洲高清不卡在线| 热久久免费视频| 国产美女在线精品| 色狠狠一区二区三区香蕉| 欧美欧美午夜aⅴ在线观看| 精品理论电影在线| ...av二区三区久久精品| 亚洲午夜一区二区| 国产一区中文字幕| 91在线免费播放| 日韩一级片网址| 欧美国产日韩a欧美在线观看| 亚洲人成精品久久久久| 日韩电影在线观看网站| 成人午夜免费av| 欧美日韩精品一区二区| 久久先锋影音av鲁色资源网| 欧美一区二区三区不卡| 男男gaygay亚洲| 首页综合国产亚洲丝袜| 国产真实乱偷精品视频免| 91亚洲永久精品| 91精品国产综合久久久久久久久久| 国产亚洲成av人在线观看导航 | 欧美日韩高清一区二区| 久久综合九色综合欧美就去吻| 国产精品久久久久久久蜜臀| 午夜在线成人av| 成人黄色小视频| 日韩欧美美女一区二区三区| 成人免费在线播放视频| 久久99蜜桃精品| 在线观看免费一区| 国产精品久久久久一区二区三区| 五月天精品一区二区三区| 成人av在线影院| 欧美www视频| 亚洲国产日韩av| 91麻豆精东视频| 国产亚洲1区2区3区| 日韩黄色免费网站| 日本道色综合久久| 亚洲国产高清在线观看视频| 一区二区三区四区五区视频在线观看 | 极品少妇xxxx偷拍精品少妇| 成人的网站免费观看| 欧美一区二区精美| 亚洲精品伦理在线| 精品国产1区二区| 亚洲福利一区二区三区| www.亚洲色图| 国产欧美久久久精品影院| 强制捆绑调教一区二区| 欧美日韩精品一区二区在线播放| 亚洲欧美日韩一区二区| 成人综合婷婷国产精品久久蜜臀| 日韩三级精品电影久久久| 肉色丝袜一区二区| 欧美日韩一区二区三区四区 | 99热在这里有精品免费| 久久精品夜夜夜夜久久| 极品少妇一区二区三区精品视频| 日韩亚洲欧美一区二区三区| 五月激情丁香一区二区三区| 欧美日韩一级视频| 亚洲精品视频在线观看网站| 91官网在线观看| 亚洲在线观看免费视频|