Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Applet - Socket creation to a HTTP server  RSS feed

 
Karthik Banda
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Every one...
Here i have a problem which may have lots of interest among all the java folks on networking. I had an applet which opens a Socket connection to a Server on its running port. I am using a PrintWriter object to write the protocol String like GET/index.html HTTP/1.1 to it. Then i have one BufferedReader to get all the headers from index.html. My index.html file actually in its doGet() method writes an object to an like say
Coming back to my applet, i after reading the headers using BufferedReader object now need to read the object. So i am using ObjectInputStream on the same port and trying to initialize this.
But i am encountering a StreamCorruptedException..
So i tried with closing the BufferedReader after i finish reading the headers... but the Socket is also closed with this statement.
So can any one please suggest me how to solve this problem...
I am here by giving my entire code as what i worked out for
Applet code
***********

*************************************************
Servlet code
************

*************************************************
So if any one finds a good solution or suggest me how can we get about this... please mail me at
karthik@electricangels.com....
Hope an extended hand on this issue...
Regards,
karthik
[ Inserted CODE tags -- PdH ]
[ January 17, 2003: Message edited by: Peter den Haan ]
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kneejerk reaction would be: apparently there's something going wrong in the transition from reading the header to reading the binary stream that follows. But why descend to this level of detail -- what's wrong with URL, HttpURLConnection and friends?
- Peter
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!