全文预览

FTP客户端的设计实现代码

上传者:你的雨天 |  格式:doc  |  页数:20 |  大小:0KB

文档介绍
.indexOf( ')' , opening + 1); if ( closing > 0) { String dataLink = cmdline .substring( opening + 1, closing ); StringTokenizer tokenizer = new StringTokenizer( dataLink , "," ); try { ip = tokenizer .nextToken() + "." + tokenizer .nextToken() + "." + tokenizer .nextToken() + "." + tokenizer .nextToken(); port = Integer. parseInt ( tokenizer .nextToken()) * 256 + Integer. parseInt ( tokenizer .nextToken()); } catch (Exception e){ jTextAreaStatus .append( "Cannot get passive mode Ip & Port" + "\n" ); }}} private Socket dataConnection(String ctrlcmd ){ String cmd = "PORT "; int i; Socket dataSocket = null ; try { byte [] address = InetAddress. getLocalHost ().getAddress() ; ServerSocket serverDataSocket = new ServerSocket(0,1) ; for (i= 0; i< 4; ++ i) cmd = cmd +( address [i]& 0xff) + "," ;

收藏

分享

举报
下载此文档