我正在尝试使用Telnet连接到主机,但我收到 java.net.UnknownHostException:
以下是供您参考的代码....
public AutomatedTelnetClient(String server, String user, String password) throws IOException {
try {
telnet.connect(server, 23);
} catch (Exception e) {
e.printStackTrace();
}
}
STACK TRACE: -
java.net.UnknownHostException: 10.0.246.242 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)at java.net.Socket.connect(Socket.java:525)at org.apache.commons.net.SocketClient.connect(SocketClient.java:176)at
connect.AutomatedTelnetClient.<init>(AutomatedTelnetClient.java:25)at Connect.AutomatedTelnetClient.test(AutomatedTelnetClient.java:113)at TelnetConnetct.jButton1ActionPerformed(TelnetConnetct.java:110)at TelnetConnetct.access$000(TelnetConnetct.java:20)at TelnetConnetct$1.actionPerformed(TelnetConnetct.java:55)at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)at java.awt.Component.processMouseEvent(Component.java:6263)at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
我正在尝试使用Tenet连接到远程系统有三个接受主机ID,用户名和密码的文本框
当我在做Ping时:
`Ping statistics for 10.0.246.242:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:Minimum = 0ms, Maximum = 17ms, Average = 4mshere`
答案 0 :(得分:0)
java.net.SocksSocketImpl.connect(PlainSocketImpl.java:177)at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
这表示Java无法为主机创建套接字,有关套接字的更多信息:http://download.oracle.com/javase/1.4.2/docs/api/java/net/Socket.html
您是否尝试使用PuTTY之类的东西telnet到服务器?在这里下载链接: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
编辑: 未知的主机异常意味着找不到IP,它与telnet失败无关。