I'm getting java.net.SocketException in the portion of code with try-catch IOException with no output of errors. SocketException is a successor of IOException so why?
try {
Socket net = new Socket(TARGET, PORT);
sendRawLine("GET / HTTP/1.1", net);
sendRawLine("request", net);
net.close();
} catch (IOException e) {
// System.out.println(e);
}
java.net.SocketException: Connection reset
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:118)
at java.net.SocketOutputStream.write(SocketOutputStream.java:159)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at java.io.BufferedWriter.flush(BufferedWriter.java:254)
at com.Joorvish.sendRawLine(Joorvish.java:125)
at com.Joorvish.createSockets(Joorvish.java:99)
at com.Lorento.run(Lorento.java:15)
at java.lang.Thread.run(Thread.java:744)
java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
at java.net.SocketOutputStream.write(SocketOutputStream.java:159)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at java.io.BufferedWriter.flush(BufferedWriter.java:254)
at com.Joorvish.sendRawLine(Joorvish.java:125)
at com.Joorvish.createSockets(Joorvish.java:100)
at com.Lorento.run(Lorento.java:15)
at java.lang.Thread.run(Thread.java:744)
at com.Joorvish.sendRawLine(Joorvish.java:125) at com.Joorvish.createSockets(Joorvish.java:99)This makes me suspect thatsendRawLineis somehow used wrongly. Do you have some Docu about that method?sendRawLine()for evaluation. Surely this is obvious? and the request for the code? and the stack trace? How exactly do you expect people to help you here? Magic?