hey guys, i'm currently trying to create a little web application for my school to assist with the live internet broadcast of speakers that they run. i understand that it is possible to create a socket level connection between a servlet and an applet, but i cannot find any documentation on how to do so. i know a decent amount about servlets and a decent amout about applets, but i know little technically about having the two communicate. could someone please explain how i would do this? any code snipets would be much appreciated.
Hey Chris: I think you need a book JAVA Developer's Guide to Servlets and JSP by Bill Brogden. I bought this book thinking it only focus on Servlet and JSP, nah! I was wrong. Chapter 12 of this book Applet - to - Servlet Communication that what you wanted. I have not read yet that chapter. I am pulling my hair on ch3 CHATROOM to understand session tracking. I do not know when I will have decent amount of servlets understanding. Good Luck. BK
i know a decent amount about servlets and a decent amout about applets, ... i know little technically about having the two communicate. could someone please explain how i would do this? any code snipets would be much appreciated.
The magic word is URLConnection. If your applet creates one of these, it can internally send and receive web requests. If you use straight sockets you end up having to do the grunt work yourself (among other things, URLConnections make working with sessions easier). Also, anything that uses TCP/IP ports other than standard http (or https) ports won't make it through most firewalls. Beyond that, you really need to go to a good book on Java Network programming. Or at least a book with a good chapter on this kind of stuff.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Oct 16, 2001
yeah, the reason i want to use sockets is so that i can use the mvc notifier model. i have a back-end object model, and i'm using the servlet as the controller, and the applets as the view. i was hoping to just send the updates to and from the clients as nessecary. Also i'm banking on the fact that the ports are closed on the firewall, i don't want people outside the network using it. That's why i want to use sockets. I just don't know how. I know that an applet can make a url connection to a servlet, but after that, how do i make a bi-directional socket level connection between the two. I already have a socket level protocol drawn out. I just need to know how to establish the connection. Thanks again. ps. bal, i havn't gotten a chance to look at that book yet, but thanks.
subject: Socket connection between servlets and applets