• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ConnectionException :connect

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the root cause of this error message "ConnectException : Address is invalid on the local machine or port is not valid on the remote machine"....???
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not a detailed question. Anyway you could be using a reserved port no.?

You can create a server on ports 1 through 65535. Port numbers less than 256 are reserved for well-known services (like HTTP on port 80) and port numbers less than 1024 require root access on UNIX systems. Specifying a port of 0 in the ServerSocket constructor results in the server listening on a random, unused port, usually >= 1024.

Not sure why address is invalid. Try something like this on Client side:

String host="localhost";
int port_number=2229;//sample port no.

clientSocket = new Socket(host, port_number); // static Socket clientSocket = null;
 
Abhijith Sugunan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finally i got it correct . The problem is that my firewall blocks the request and it works only in home network mode . It will not work in private and public mode
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic