Results 1 to 17 of 17
  1. #1
    Join Date
    Aug 2011
    Posts
    22
    Rep Power
    0

    Default How can client gain access to my RMI server remotely?

    I am using my home PC as a server for my program. The server uses RMI to communicate back and forth with clients. I have been using a IP address that looks something like 30.30.30.300 (not exactly it, but it looks nice and round like that), this IP works for the RMI when the program is run locally. However when I attempt to run the client remotely using this address it obviously does not work. I tried using the address provided to me on What Is My IP Address - Shows Your IP Address, but that doesn't even work when I run the program locally.

    Do I need to purchase a DNS server or something in order for the client to locate my server? Or is there a way for the client to access my server without that?

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: How can client gain access to my RMI server remotely?

    it obviously does not work
    Please explain. What URL does the client PC use?
    What error does the client see when it tries to connect?
    Is your PC behind a firewall or router that could block access to your PC?

  3. #3
    Join Date
    Aug 2011
    Posts
    22
    Rep Power
    0

    Default Re: How can client gain access to my RMI server remotely?

    The server uses the following code to post a remote method:
    Registry registry = LocateRegistry.createRegistry( 1099 );
    Naming.rebind("UserLogin", stub);

    The client then uses this code to access the remote method:
    Registry registry = LocateRegistry.getRegistry("10.10.10.100");
    UserLogin stub = (UserLogin)registry.lookup("UserLogin");

    My computer's firewall is currently disabled and my modem and router have port 1099 open.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: How can client gain access to my RMI server remotely?

    Have you tried using simple ServerSocket / Socket client server programs to see if you can connect with a simpler program to validate that you can connect at all?

  5. #5
    Join Date
    Aug 2011
    Posts
    22
    Rep Power
    0

    Default Re: How can client gain access to my RMI server remotely?

    I have not tried this. However I can get the RMI to work for computers on my own network. ie: If I run the the program on my wife's desktop, it is able to access and communicate with the server on my computer.

    What I am really unsure of is what address to use to access the server from outside the network. The 10.10.10.100 works within the network but does not work from outside of it. I tried using the IP address that I get from What Is My IP Address - Shows Your IP Address (ie: Naming.rebind("rmi://myIPaddress/UserLogin", stub);), but I get a "connection refused to host" error.

    If I were to use a simple ServerSocket/Socket program for testing as you suggest... what address should I be looking to use?

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: How can client gain access to my RMI server remotely?

    I'm not sure how you can find the IP address of your own computer when it's on a LAN behind a router.
    My router has an interface that I can use to get statistics about the connections etc.

    There are some sites I've visited that will tell you what your IP address. Try Google.

  7. #7
    Join Date
    Aug 2011
    Posts
    22
    Rep Power
    0

    Default Re: How can client gain access to my RMI server remotely?

    I think I have a DNS address that I would like to try and use, but how can I get my RMI to post to this address? It keeps defaulting to use my local IP. I read something about changing the property java.rmi.server.hostname however I don't know where and how to change it.

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: How can client gain access to my RMI server remotely?

    Do you have an IP address the works with a simple client-server set of programs? You know your real IP address and can access it.

    I don't know about using DNS

  9. #9
    Join Date
    Aug 2011
    Posts
    22
    Rep Power
    0

    Default Re: How can client gain access to my RMI server remotely?

    I used a sample socket program found at Java Socket Programming Example to test my real IP address.
    In the Requester class I changed the line:
    requestSocket = new Socket("localhost", 2004) to requestSocket = new Socket("myrealIP", 2004) //myrealIP = the IP address given to me at What Is My IP Address - Shows Your IP Address

    When I run the server and the client, with myrealIP I get:
    java.net.ConnectException: Connection refused: connect
    at java.net.TwoStacksPlainSocketImpl.socketConnect(Na tive Method)....

    But it runs fine when I leave it as "localhost".

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: How can client gain access to my RMI server remotely?

    I think you need to resolve the connection problem you get with the simple client server programs before trying the RMI code.

  11. #11
    Join Date
    Aug 2011
    Posts
    22
    Rep Power
    0

    Default Re: How can client gain access to my RMI server remotely?

    Well the simple client server program works fine so long as I use a computer within my network. Once I leave the network, it won't work. Does it matter that I'm on Windows XP do I need Windows Server for RMI to work outside of the network?

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: How can client gain access to my RMI server remotely?

    so long as I use a computer within my network.
    Is that where you want to use your RMI programs? Problem solved.

  13. #13
    Join Date
    Aug 2011
    Posts
    22
    Rep Power
    0

    Default Re: How can client gain access to my RMI server remotely?

    No, I intend to distribute the client program.

  14. #14
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: How can client gain access to my RMI server remotely?

    If you can not access your PC with an IP address using the simple client-server, do you think using RMI will be easier?
    It could be, I have not tried RMI from outside of a localhost environment.

  15. #15
    Join Date
    Aug 2011
    Posts
    22
    Rep Power
    0

    Default Re: How can client gain access to my RMI server remotely?

    It's really about the same for testing purposes since I already have the RMI structure laid out. I'm probably going to mess around with my router and modem settings to see if the answer's in there somewhere.

Similar Threads

  1. remotely access video stream from camera
    By adityapr in forum Networking
    Replies: 1
    Last Post: 05-03-2011, 11:07 PM
  2. Replies: 2
    Last Post: 09-24-2010, 12:31 PM
  3. Replies: 1
    Last Post: 03-20-2010, 08:03 PM
  4. Replies: 1
    Last Post: 10-05-2008, 04:12 PM
  5. Identify Client in Socket Client Server Application
    By masadjie in forum Networking
    Replies: 1
    Last Post: 12-20-2007, 10:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •