This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Applets and the fly likes Getting permissions to open a socket Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Getting permissions to open a socket" Watch "Getting permissions to open a socket" New topic
Author

Getting permissions to open a socket

Erick Smith
Greenhorn

Joined: Apr 09, 2000
Posts: 21
OK, I would like to improve my applet so that it accesses a Server program via a client/server system.
I am thinking I should just write my own Server program and just open a socket to it on some port. I have two questions, however:
1) How do I set the proper permissions on my Host machine so the applet can connect to the Server program from elswhere on the Internet?
2) What would be the pro's and con's of using a Applet/Servet combo to do this? Or does Applet/Servlet not work like Client/Server?
Thanks,
Erick
PS - This board has been far more helpful to mee than any boards on the Sun site! Thanks much for everyone's previous help.
Tom P
Ranch Hand

Joined: May 06, 2000
Posts: 88
No permissions are required. All you need is a ServerSocket listening on some port. The only requirement is that the Applet must be connecting back to the server it came from. The browser's security mechanism will not allow the applet to connect to any other server unless it has a security certificate AND the user gives permission.
I personally prefer the applet/servlet combo. The only difficulty is in maintaining state on the server side but you can do that through the data you pass back to the server. Also, with the applet/servlet comination there is no browser security limitation on connecting to a different server than the applet came from.
[This message has been edited by Tom P (edited May 06, 2000).]
Pawel Veselov
Ranch Hand

Joined: Jan 14, 1999
Posts: 165
Just add-on. Applet can open a connection only to the host this applet was downloaded from.

With best of best regards, Pawel S. Veselov ( aka Black Angel )
Tom P
Ranch Hand

Joined: May 06, 2000
Posts: 88
Yes, I mentioned that in my answer. If you need to go to another server you will need a certificate.
Pawel Veselov
Ranch Hand

Joined: Jan 14, 1999
Posts: 165
Oops, my fault :O
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting permissions to open a socket
 
Similar Threads
Socket Applets
How to create a chat server for my hostel
I want observer/observable implemented in Servlet/Applet
java.net.ConnectException: Connection refused
Can I Have Two-Way Communication with Sockets with just one Port?