Hello Friends, I am attempting to make an application in servlets similar to messenger and my problem is how do I connect the clients machine with the servlet once he logs in,since the messengers are basically downloaded products and once u logon and connect your browser gets invoked. Can anyone help me.Thanking all of u in advance.bye.
Pranav Jaidka
Ranch Hand
Joined: Sep 14, 2000
Posts: 264
posted
0
hi kavita 1> try creating a URL object with the url of the servlet. then Using a URLConnection or an HTTPConnection object in which you can pass the url as parameter for Ex con = url.openConnection();
2> If the above succeeds (it should if your URL is correct). then your work is done. 3> do the following as per your rewuirements.... con.setDoInput(true); con.setDoOutput(true); con.setUseCaches(false); where con is the connection object. 4>now the final stage involves the obtaining of the input and output streams for the Connection use inputFromServlet = new ObjectInputStream(con.getInputStream()); outputToServlet = new ObjectInputStream(con.getInputStream()); 5> your program is ready ....after this you can use the streams to pass the values....(you need to have corresponding streams at the servlet end) and dont forget to flush the streams to get results at the other end. Hope this is good enough for you ...in case of any doubts you can mail me at pranav@infics.com good luck