• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

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

 
Ranch Hand
Posts: 826
Eclipse IDE Oracle Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 4308
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Eclipse IDE Oracle Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Bartender
Posts: 9625
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Eclipse IDE Oracle Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9625
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic