Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Server Port problem

Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.


Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Alain Dickson
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
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,
Ruth Stout was famous for gardening naked. Just like this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic