This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes SOS!!!!!!!!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "SOS!!!!!!!!!!" Watch "SOS!!!!!!!!!!" New topic


Geoffrey Ren

Joined: Nov 25, 2002
Posts: 18
String urlString = "http://localhost:8080/esp/SearchLesson";
URL url = new URL(urlString);

int port = url.getPort ();

if (port == -1)
port = 80;

socket = new Socket(url.getHost (), port);

out = socket.getOutputStream ();
InputStream in = socket.getInputStream();

Writer writer = new OutputStreamWriter (out, "ISO-8859-1");

writer.write ("POST " + url.getFile () + " HTTP/1.0\r\n");

String contentType = "application/x-www-form-urlencoded";

writer.write ("Content-type: " + contentType + "\r\n");

String condition = "userid = 'test'";;

Vector result = new Vector();
ObjectInputStream read = new ObjectInputStream(in);
writer.write ("Content-length: " + condition.length() + "\r\n\n");
writer.flush ();
while ((result = (Vector)read.readObject()) != null)
return result;
socket.close ();
catch (ClassNotFoundException nf)
catch (StreamCorruptedException se)
catch (IOException ex)
ex.printStackTrace() ;
if (socket != null)
socket.close ();
catch (IOException ignored)
throw new IOException("operation failure");

which throw the exception: Caught EOFException while reading the stream header
at Source)
at<init>(Unknown Source)
at com.esp.courseware.util.SCORMUtils.getLessonListByCondition(
at com.esp.gui.fwk.controller.TableViewController.actionPerformed(
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at Source)

Please help me!!!
Vijayakumar Arya
Ranch Hand

Joined: Jan 27, 2003
Posts: 76
Please compile your code with -g option so that you can know at which line of your code has thrown the exception, after doing this we have to trace the root cause of the exception.
Also use

Thanks,<p>Vijay<p>The Hand that gives, Gathers.
I agree. Here's the link:
subject: SOS!!!!!!!!!!
jQuery in Action, 3rd edition