How can applet send information to my serlvet?
1 posts in topic
Flat View  Flat View

Posted By:   Neaven_Seo
Posted On:   Sunday, June 2, 2002 07:38 PM

			I'm developing a file explorer that runs on the web.
Now I need to find out how can I allow my file explorer applet to communicate with my servlet.
I know that I can open a URL connection back, but I'm not very sure how to do that.
Can anyone advise me? Thanks! Have a great day :)

Re: How can applet send information to my serlvet?

Posted By:   Tino_Dai  
Posted On:   Monday, June 10, 2002 05:34 PM

how about something like this:

Applet Side:

Host = getCodeBase().getHost();
Connect = new Socket(Host,4444);
BufferedReader ChatInput = new BufferedReader(new InputStreamReader(Connect.getInputStream()));

PrintWriter ChatOutput = new PrintWriter(new OutputStreamWriter(Connect.getOutputStream()));

/* This will create a new connection to your host, and remember that the applet can only talk to the server that it originated from */

Servlet Side:

ServerSocket Socket = new ServerSocket(4444);
/* You probably need to thread these out one for each applet connection that you have and have a while loop of some sort for each thread */

About | Sitemap | Contact