java.net.UnknownHostException: 10.0.246.242
I am Trying to connect to Host using Telnet but I am getting java.net.UnknownHostException:
Here is the Code for your reference....
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)
I am Trying to connect to remote system using Tenet Having three text boxes which accepts Host id, username and password
When i am Doing 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`
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at
That says that Java was unable to create a Socket to the host, more info about sockets: http://download.oracle.com/javase/1.4.2/docs/api/java/net/Socket.html
Have you tried to telnet to the server with something like PuTTY? Download link here: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Edit: Unknown host exception means the IP was not found, it doesn't have to do with telnet failing.
精彩评论