• Post Reply Bookmark Topic Watch Topic
  • New Topic

Connection Refused  RSS feed

 
Kang Wang
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to use a socket to localhost, but cannot connect. Here is my code:

Socket socket = null;
try{
socket = new Socket( "localhost", 8088 );
}catch(IOException e){
e.printStackTrace();
}
//clean up.

It gives me "java.net.ConnectException: Connection refused: connect".

Is this the right way to it?

Thanks very much.
Kang
 
Kang Wang
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have resovled this problem. I didn't create a server socket that listens on the specified port. Learning is always fun.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!