aspose file tools*
The moose likes Applets and the fly likes Applet + Application communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet + Application communication" Watch "Applet + Application communication" New topic
Author

Applet + Application communication

john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

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.


“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

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

Joined: Feb 24, 2011
Posts: 495

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applet + Application communication