0

Ok, I'm at my wits end with this. I need to write a server and client that can be run on different machines connected to the internet (not on the same network/router). I've tried RMI, RMI-IIOP, EJB/GlassFish, CORBA and nothing I do works (over the internet). I must have followed 30 tutorials, examples and guides, but they are all designed to be run on a single machine which doesn't work when attempting to connect remotely from a different computer.

All I want is a "hello world" type example where the server is launched/deployed from computer 1 and the client is run on computer 2 and they can exchange simple objects and variables over the internet. So I can deconstruct it and "see" what I'm doing wrong.

Please, please, please can someone point me in the direction of a tutorial or just code that specifically communicates over the internet.

I've been all over Oracle, netbeans, coderanch, stackoverflow and found nothing that has helped.

I'm using NetBeans 8.0.2 with GlassFish 4.1 on Windows 7 (both computers)

EDIT - to clarify question.

I have written a program that works in a similar way to Teamviewer where I can monitor the screens of multiple computers on the same network and if needed interact with those computers. My software essentially grabs screenshots and transmits them as byte arrays as well as sending various simple data objects containing screen, system, mouse and keyboard information. This works fine with RMI but I want to expand it to be able to support computers who are not on the same network, so via the internet. I have read here RMI is not suitable and my testing has confirmed that. So my next logical step was to EJB or RMI-IIOP but I simply cannot get those to work over the network let alone over the internet. So I'm really asking here for some help to understand what I'm doing wrong, hence the "hello world" over the internet request. I have very little experience with this and every example is always local, so I need to bridge the gap from local to internet. I think part of my misunderstanding was that I thought Glassfish exposed my server experiments to the internet and not just locally. As you can see, I have some gaps in my knowledge that I was hoping you may be able to help me fill.

Tony Bock
  • 21
  • 3
  • you should check how to change the configuration in those tutorials. What is your actual question, keeping in mind that we don't hand out code? – Stultuske May 26 '15 at 09:34
  • For me it seems that you have a problem to distuinguish between your local server instance (available to your computer only), and actual, internet- connected server. You have written that you are using GlassFish 4.1 server, the question is, where is this server available:)? Is it deployed on your computer only, or is it hosted by some remote internet service? To make your service available, you have to grant to it some public domain. This can be easily done at https://www.openshift.com . Read some tutorials included there, and within a few days you will be able to publish your service. – Tinki May 26 '15 at 10:03
  • I've updated the OP to clarify. I think this is exactly my problem. I'm registering with openshift right now and hopefully I can progress with this further. – Tony Bock May 26 '15 at 15:57
  • You've clarified nothing. You've stated that something didn't work and you've asked how to do something else. It is all complete vague. You also have an [existing question](http://stackoverflow.com/questions/30415756/rmi-iiop-over-the-internet) on the same topic where you've accepted an answer and asked a continuation question which has also been answered. – user207421 May 26 '15 at 18:00
  • Incorrect! I've asked again (with more detail of what I plan to use it for) if anyone can help me to understand, preferably with links to examples of how to use these technologies over the internet. The other guys here seem to understand what I'm asking, what is your problem? – Tony Bock May 27 '15 at 02:09
  • For the record, the answer on the "previous" continuation question didn't help, hence I didn't mark it as answered. I have however now stated that it didn't help. – Tony Bock May 27 '15 at 02:25
  • (1) EJB uses RMI-IIOP. (2) You have an existing question about RMI-IIOP which I have provided two answers for already, one of which you marked as correct, and the other of which you haven't even commented on. Stick to one question. This one is just vague. – user207421 May 27 '15 at 02:27
  • I think I answered at the same time as you wrote this. OK, I'll stick to the previous question. – Tony Bock May 27 '15 at 04:48

1 Answers1

0

I would suggest a RESTful Web service (with JSON). You can set one up in minutes with GlassFish and NetBeans (example: http://java.dzone.com/news/simple-restful-web-services). Since REST runs over HTTP, it's firewall-transparent. You can also easily test it using just your browser.

Also, make sure that you can reach the server machine from the client. Routing problems may be the issue here. Keep in mind that you cannot easily call a server that doesn't have a public IP address.

UPDATE

Unfortunately my reputation is too low to comment under your question, so trying here. I think your problem is lies in the domain of computer networks rather than any of the Java technologies you are trying. Let's assume you are running the server on your PC and asking a friend to call a service on this server form his/her PC. Most probably it won't be possible because both of you are behind NAT and can't see each other's IP address. There are technologies that help overcome this, but all of them require a 3rd party service. Every server directly reachable over the Internet has a public IP address, but those cost money and require some additional network configuration. If this is not an issue, make sure the server's IP is routable from the client. Try pinging the IP to start with. Another problem may be a firewall. Make sure nothing blocks the ports and protocols used by the technology of your choice. So far as I know, the technologies you've mentioned are not supposed to be used over public networks. That is why I suggested REST - it can help you rule out network problems and test basic connectivity between the client and server.

vempo
  • 3,093
  • 1
  • 14
  • 16