Meaningless Drivel is fun!*
The moose likes Sockets and Internet Protocols and the fly likes I am getting java.net.UnknownHostException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "I am getting java.net.UnknownHostException" Watch "I am getting java.net.UnknownHostException" New topic
Author

I am getting java.net.UnknownHostException

Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
here is my socket example


when i run this programm i am getting this error


i got this example from this URL
http://java.sun.com/docs/books/tutorial/networking/sockets/readingWriting.html

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41068
    
  43
This has nothing to do with that particular problem, but there's another one lurking: Don't println to a Socket


Ping & DNS - my free Android networking tools app
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
what do you mean nothing to do.Still i am getting error?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Right. You're trying to connect to a computer named "taranis" but there's no such computer in your network. Talk to the person who manages your network and ask them to explain to you the basics of how computer networks work.
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
I don't have a networ here.there is only one computer.can't we check socket using localhost?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41068
    
  43
If you don't have a network, how do you propose to connect to another computer?
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
can't we use a same machine to do this?i mean localhost
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9924
    
158

Samanthi perera wrote:can't we use a same machine to do this?i mean localhost


echoSocket = new Socket("taranis", 7);

What is "taranis"


[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9924
    
158

Samanthi perera wrote:

i got this example from this URL
http://java.sun.com/docs/books/tutorial/networking/sockets/readingWriting.html



You seem to have literally copied that example and did not even read what those lines of code are meant for. There's an explanation about the code on that page. It even tells what the first param "taranis" is. Have you read that?
 
wood burning stoves
 
subject: I am getting java.net.UnknownHostException
 
Similar Threads
Reading a binary file from a client to server
what is the prob !!!
Guys, need help on tcp socket (Urgent)
How to run Client socket?
Socket problem