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

Server Port problem

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

Thanks,
Alain



 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
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
 
Good heavens! What have you done! Here, try to fix it with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic