Sunil Chandurkar wrote:

> Hello All..
>
> Though i'm working on servlets from couple of months
> i'm getting confused between doGet and doPost whenever i'm trying to do 
>Applet-Servlet Communication.
>
> My Problem is :
>
> On particular event my Applet is sending one string to Servlet and inresponse 
>servlet is sending one Vector to applet.
> If i will keep on performing Applet - Servlet communication,hardly i can perform 2-3 
>transactions.
> On 4th request from applet to servlet .. my browser gets hung.
> I have written entire code in doPost of servlet.
>
> I am very much confused where shall i write the code on servlet side in doGet or in 
>doPost.. and one more thing.. i have tried by writing code into doGet also.
>
> I have already visited lots of sites from where i could get this solution.. and 
>according to their samples. i did everything. but still problem is there only.
>
> If anybody is having perfect solution on this Applet-Servlet communication please 
>let me know...
>
> Regards
> Sunil
> [...]

haha :-)  I think I know a little about it, I find it is interesting :-)  but I am
not sure, the following is just as a reference:

*  I use:
    - standalone Java Appllication: JDK1.3 + winnt40
    - Servlet:  jakarta-tomcat-4.0-b1(standalone, JDK1.3, winnt40)

* I guess Applet-Servlet communication is similar with Application-Servlet
   communication.

*  normally, it is Appllication-side who starts one Appllication-Servlet communication:

*  client First Read style:
    in Appllication-side, if we first Read something from Servlet,  then no matter
     we will continue to Write something to Servlet or not,  doGet will be
     invoked

*  client First Write style:
    in Appllication side, if we first Write something to Servlet, then:
   - if we don't continue to Read somwthing from Servlet, then neither doGet
     now doPost will be invoked :-)
   - if we continue to Read something from Servlet, then doPost will be invoked :-)
   - if we want to Write something, we need: uc.setDoOutput(true),  otherwise I
     got a java.net.ProtocalException

*
   - if we want to Read something, we need: uc.setDoInput(true),  otherwise I
     got a java.net.ProtocalException
   - if we want to Write something, we need: uc.setDoOutput(true),  otherwise I
     got a java.net.ProtocalException

*  we can use both URLConnection and HttpURLConnection. but I remember
    HttpURLConnection is not in NN4.7 and IE4.x(perhaps I remember wrong)



Bo
Mar.28, 2001


Reply via email to