File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes ConnectionException :connect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "ConnectionException :connect" Watch "ConnectionException :connect" New topic
Author

ConnectionException :connect

Abhijith Sugunan
Greenhorn

Joined: Aug 04, 2012
Posts: 10
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"....???
Ash Chan
Greenhorn

Joined: Jan 09, 2013
Posts: 3
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

Joined: Aug 04, 2012
Posts: 10
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ConnectionException :connect
 
Similar Threads
database connection
Can you guess what this is?
what is computer
Java
WA #1.....word association