类似ftp类协议的登录是怎么做的?
来源:互联网 发布:网络主播vip群福利在线 编辑:程序博客网 时间:2024/04/29 05:27
eg:
public String[] connect(String host, int port)
throws IllegalStateException, IOException,
FTPIllegalReplyException, FTPException {
synchronized (lock) {
// Is this client already connected to any host?
if (connected) {
throw new IllegalStateException("Client already connected to "
+ host + " on port " + port);
}
// Ok, it's connection time. Let's try!
Socket connection = null;
try {
// Open the connection.
connection = connector.connectForCommunicationChannel(host, port);
if (security == SECURITY_FTPS) {
connection = ssl(connection, host, port);
}
// Open the communication channel.
communication = new FTPCommunicationChannel(connection, pickCharset());
for (Iterator i = communicationListeners.iterator(); i.hasNext();) {
communication.addCommunicationListener((FTPCommunicationListener) i.next());
}
// Welcome message.
FTPReply wm = communication.readFTPReply();
// Does this reply mean "ok"?
if (!wm.isSuccessCode()) {
// Mmmmm... it seems no!
throw new FTPException(wm);
}
// Flag this object as connected to the remote host.
this.connected = true;
this.authenticated = false;
this.parser = null;
this.host = host;
this.port = port;
this.username = null;
this.password = null;
this.utf8Supported = false;
this.restSupported = false;
this.mlsdSupported = false;
this.modezSupported = false;
this.dataChannelEncrypted = false;
// Returns the welcome message.
return wm.getMessages();
} catch (IOException e) {
// D'oh!
throw e;
} finally {
// If connection has failed...
if (!connected) {
if (connection != null) {
// Close the connection, 'cause it should be open.
try {
connection.close();
} catch (Throwable t) {
;
}
}
}
}
}
}
- 类似ftp类协议的登录是怎么做的?
- 建立自己的协议头---类似rtsp://ftp://的东西
- 建立自己的协议头---类似rtsp://ftp://的东西
- Http协议的Delete和Put方法是做什么的?怎么用?
- Http协议的Delete和Put方法是做什么的?怎么用?
- Http协议的Delete和Put方法是做什么的?怎么用?
- 这样的网址是怎么做的?
- Tensorflow的LRN是怎么做的
- ftp 协议和 http 协议是如何实现的?
- 透明滚动条是怎么做的?
- 看看老外是怎么做乘法的!
- 看看老外是怎么做乘法的!
- 企业是怎么做大的.
- 这个效果是怎么做的?
- 大家是怎么做Code Review的?
- Facebook是怎么做MySQL备份的?
- 竞价是怎么做的啊
- 华为硬件开发是怎么做的?
- C++中析构函数为什么要是虚函数
- transient关键字:串行化,保护第三信息
- Android开发之数据保存技术
- Eclipse平台的协议
- HDU 3920 Clear All of Them I 状态压缩DP 2011 Multi-University Training Contest 9 - Host by BJTU
- 类似ftp类协议的登录是怎么做的?
- 索引器例子_C#
- 测试我们的程序性能
- 数据库连接池技术
- C 数组
- 从数据库连接池中获取连接调用close后,为什么不是关闭物理连接?
- 利用memcached java client一个简单的应用
- ubuntu 编码 UTF-8 GBK GB18030
- <同步,异步>与<阻塞,非阻塞>的区别?