• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: network client access

 
Simon Ingram
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there, ranchers!
In order to access one's RMI application as a network client, we must supply the ip address and a port number. I have found that I can configure my server at port 1099 and then access the application as a client with any port number I like! I am working in loop back on a single PC at the moment. The reason is that the client gets the stub from the RMI registry using a command with a syntax as follows:

In other words there is no reference to the port number. What are you guys doing about this? Clearly one can add validation to make the client port number match the server port number, but I was expecting the system to fail in some way if the port numbers don't match.
Any thoughts on this would be appreciated.
regards
Simon
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If no IP address is given, I think it defaults to the 1099 port.
As for the validation, I'm not sure you can do anything about it as you are suggesting: the server may be running on any port, so there's no way for you to know when you're developing and hardcode it in.
I believe everybody, including me, just lets the client give a port, validate that it's a valid value for a port (> some number, eg 0), and try to get the stub. If there's a RemoteException that indicates that the server couldn't even be connected to, then either the server isn't running or the port is incorrect. There are other exceptions that would indicate other errors, such as being able to connect, but not having the skeleton bound to the name. And so on...
Does that give you any ideas?
 
Simon Ingram
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply, Nathaniel. If it is as you say, then thanks, it makes life simpler. I thought that one used ip address and port number together and that you needed both bits of info to make a network connection. I was surprised to see my application working when my client and server are using different port numbers. I figured there was a piece missing in my jigsaw puzzle, if you know what I mean. Anyway, thanks for your help. By the way, I am very impressed by your 3 developer certifications. I don't think you will be for hire for long! I also liked your comment about the exam being as easy as a walk in the park with a beautiful girl. That's what I call poetry, very much better than all that other stuff about the Singleton Design Pattern!
regards
Simon
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic