Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet + Application communication

 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just got an idea for an Applet to Application program...
Using TCP/IP...
So basically, the client is the Applet. The application is the server (1 application running, any number of Applets running). The Application's IP is dynamic. A different Application connects to the Applet to tell it it's IP address. Then, the stream closes. The Applet then connects to the regular Application. Is this possible? If I do this, can I avoid signing it (I know this is an applet question, but I feel it is okay because it deals with sockets and IP)?

Thanks,
cc11rocks

EDIT (Clarification) : There will be two applications running...One is for telling the Applet it's IP address (That is the "different Application" part). The other is the main server.
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An applet can only connect to the very same server it's downloaded from, and you can use getCodeBase() or getDocumentBase() to get a URL from which you can receive the server. If you want to connect to anything else you will have to sign the applet.

I'll still move this thread to our Applets forum since it's an applet specific problem.
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I made the Client (Applet, just a simple test) :


Then, I made the Server (Application) :


I made the Applet into a signed JAR. I put it unto a test website ( http://appletclient.webs.com ).
NOTE: The Applet is still on the website. My server may not be up if you go to it...

I started my server. I then went to the website. I accepted the certificate. It successfully sent the data expected to my Server. Then, I had a friend try ( on a different computer, different IP address). He accepted the certificate, but nothing happened on the Server part. Why didn't this work? It is signed and certificated (check it out for yourself). It works fine if I got to the link. How can I make this work?

Thanks,
cc11rocks

EDIT: Yes, I do have port forwarding enabled for port 5000. I'm very eager to get this working...
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it working. Had to add one line to main (the very first line) :


Just a thought (Unrelated) : Why are my post now being ignored? It seems the farther I go in the Java community, the less help I get. I mean, I eventually can solve most of my problems, but I need support guys. Well, anyway, thanks for helping. I really have enjoyed my stay here (I'm not leaving right now).

,
cc11rocks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic