wood burning stoves 2.0*
The moose likes Sockets and Internet Protocols and the fly likes Sockets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Sockets" Watch "Sockets" New topic
Author

Sockets

maya jain
Greenhorn

Joined: Feb 22, 2011
Posts: 5
Hi,

I am doing a client server program, The program works on the same computer (localhost), but if I give the name of another computer "MAYA-PC" I am getting the following error

java.net.UnknownHostException: MAYA-PC
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at type1.<init>(type1.java:65)
at type1.keys(type1.java:271)
at type1.access$0(type1.java:264)
at type1$1.run(type1.java:51)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierar chy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

why is this happening. Both the computers are connected to the same network

But on my computer MAYA-PC, which have both client and server program, even if I give socket = new Socket("MAYA-PC", 7777);....I am getting output. I thought that it may be a network problem and tried working client and server programs on different computers on another network too. But I got the same error.

Please Help me.

Regards,
Maya
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

Instead of name, if you use IP address does it work?


Swastik
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sockets