aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Server Port problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Server Port problem" Watch "Server Port problem" New topic
Author

Server Port problem

Alain Dickson
Ranch Hand

Joined: Dec 08, 2008
Posts: 53

Hello, I am done with coding and testing my B&S application, just found problem with port numbers.

Problem Scenario:

-I started the server by specifying host=localhost and port = 8080 (for testing)

-Starting Client on host=localhost and port=8080 --> Client successfully connects
-Starting Client on host=localhost and port=1099 (Which is default port)also works --> Client successfully connects
-Starting Clinet on host=localhost and port=any other port number other than above two do not work--> connection fails.

why doest RMI Registry allow client to connect to server when it is trying use port 1099 whereas server is listening at 8080
and why only 1099 is accepted not any other port number?

Please help, I am very near to submission and exhausted by tweaking here and there.

Thanks,
Alain



Kevin Florish
Ranch Hand

Joined: Jan 06, 2009
Posts: 176
Hi Alain.

If you start the server on port 1095.



Then when running the client change the port number to say 1096



This will cause a connect exception when you start the client as the network client cannot connect to the registry.



You should trap this error and maybe display it in a dialog box for the user.


Java5 Tutorials | Java6 Tutorials | HTML/CSS Tutorials | JavaScript and jQuery Tutorials
Alain Dickson
Ranch Hand

Joined: Dec 08, 2008
Posts: 53
kevin, thanks for the input, I was doing similar thing but had a syntax problem with url, It semms to work now.

I saw your code:
You are using LocateRegistry.createRegistry(rmiPort), This creates a registry on localhost only. If you need to use a registry running on a host other than where your server is running.

By Kevin:


My server takes following parameters:
Host:
Port:
Data File:

If I specify host other than localhost, I use LocateRegistry.getRegistry(String host, int port), But if it does not find the specified host it will return reference to registry on localhost and port 1099 (Defaults)

Do I need to wory about using rmi registry on host other than localhost, if yes, how do I know if remote host is null.

Many thanks,
Alain
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Server Port problem