Jump to content

  • Log In with Google      Sign In   
  • Create Account


[java] Applet <-> Socket


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 lkingx   Members   -  Reputation: 122

Like
Likes
Like

Posted 23 March 2000 - 08:02 AM

Hello, can i connect me to a socket from an applet, when the socketserver isn''t on the same pc as the applet?

Sponsor:

#2 eqs   Members   -  Reputation: 122

Like
Likes
Like

Posted 23 March 2000 - 08:47 AM

If what ive understood what ive been reading then the answer is no. It violates the security thingy that Sun has got put on applets.

That description sucks, so I hope one of the smart people answers this post too.

PEACE
GAZZ

#3 lkingx   Members   -  Reputation: 122

Like
Likes
Like

Posted 23 March 2000 - 09:49 AM

Sorry for my bad english, because Im from germany.


#4 joeG   Members   -  Reputation: 172

Like
Likes
Like

Posted 23 March 2000 - 03:07 PM

It''s supposed to be valid for you to connect to the server that the applet is downloaded from, nowhere else. However I''ve heard that in practice that sometimes does not happen.

JoeG

#5 Jerry Lynn   Members   -  Reputation: 122

Like
Likes
Like

Posted 24 March 2000 - 06:48 AM

With Java versions 1.1 and earlier you can communicate with the server that served the applet, but not any other server (and I think you are even prevented from communicating with other sockets on the machine executing the applet? Does anyone know if the sandbox allows this?).

It is also possible to connect to socket servers on machines other than the one serving the applet if you modify the security policies on the computer executing the applet (at least with JDK 1.2 and greater).

Modifying security policies is not something you can expect the average user to be able to do. It also requires JDK 1.2+ support, meaning that the user has to have the Java 2 Plugin installed (since almost every browser only supports the 1.1 and earlier versions of the Java platform).

So if this applet is designed to be distributed to the Internet you will have to only communicate with the server that served the applet in the first place.

#6 Jim_Ross   Members   -  Reputation: 122

Like
Likes
Like

Posted 24 March 2000 - 07:07 AM

You can always connect to URLs to get files, but you cannot send anything besides a GET, or maybe a POST. So opening a socket to a server that isn''t the one that the applet is from is kind of a far out thing to do, unless you are writing and irc, ftp, or some similar client. I believe that with an electronically signed applet it is possible to connect to foreign sockets without modifying the security manager of the client''s computer, vis gamedev''s java irc client.

Other than that, one workaround would be to have the client download the applet from the server to which it needs to connect. The applet doesn''t have to reside on the web server that serves up the webpage that has the applet.

#7 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 26 March 2000 - 09:11 PM

You can do it in a round about type of way. It''s really annoying but the answer is yes if you use tunneling. In otherwords your applet connects to a socket on the server the applet was served from and then the server opens a socket to wherever and passes the data back and forth from the applet. Like I said it is kind of annoying to write the extra code but if it has to be done it can be =)

Tim Holwig
fabel@mindspring.com




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS