• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.net.Connect Exception: Connection refused java.lang.Null Pointer Exception

 
sudipto shekhar
Ranch Hand
Posts: 826
Chrome Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a simple chat application.
The client and the server are connected through broadband internet.
After starting the chat server on one machine, when the client-side code is run it shows the following error:

java.net.ConnectException: Connection refused
java.lang.NullPointerException;

client side code:

Socket server;
Thread t;
public ChatClient()
{
super("CLIENT");
try
{
server=new Socket("192.168.01.11",5005);// IP add & Port no. of the host.

}
catch(Exception e)
{
System.out.println(e);
}

__________________________


With Regards,

Sudipto Shekhar.
 
Norm Radder
Bartender
Posts: 1239
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post the full text of the error message. Is there a line number in the error message showing where the error occurred? Look at that line and see what object reference was null.
 
sudipto shekhar
Ranch Hand
Posts: 826
Chrome Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, there was no line number or as such in the above mentioned error.
The error was as it is?
The IP add is that of the host.
The client and server are both connected through broadband internet.
What address should i use?
 
Joe Ess
Bartender
Posts: 9313
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ip address 192.168.*.* among others is not addressable across the internet. Those addresses are intended for use on private networks.
You will have to figure out the public address of your internet connections, then configure the broadband routers to allow connections to pass through.
 
sudipto shekhar
Ranch Hand
Posts: 826
Chrome Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which http protocol is to be used for broadband internet connection in place?is there any such facility?
 
Joe Ess
Bartender
Posts: 9313
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand your question. There is only one HTTP. Correct me if I'm wrong, but since you are using Sockets rather than URL/URLConnection, I don't think you are using HTTP in your application.
Are you talking about configuring port forwarding? The settings differ depending on your router/modem. This site can help you with that task.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic