• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Applet - Socket creation to a HTTP server

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic