dcsimg
Socket closing without me wanting it
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Daniel_WAMARA
Posted On:   Friday, October 1, 2004 09:28 AM

Hi I'm implementing a dummy ssl serveur ssl to test some of our application but each time I send a request to the server from the client, I got the same error: >>> First request >>> Sending LogonRequest to server CLIENT: sent C:LogonRequest.xml >>> Receiving response from server CLIENT:IOException while receiving Reading "Java Network Programming", I just came to know that It is true that a socket is closed automatically when one of its two streams is closed , when the program ends, or when it's garbage collected. Tha   More>>

Hi



I'm implementing a dummy ssl serveur ssl to test some of our application but each time I send a request to the server from the client, I got the same error:




>>> First request

>>> Sending LogonRequest to server

CLIENT: sent C:LogonRequest.xml

>>> Receiving response from server

CLIENT:IOException while receiving





Reading "Java Network Programming", I just came to know that

It is true that a socket is closed automatically when one of its two streams is closed , when the program ends, or when it's garbage collected.


That should come from the fact that I'm closing the DataOutputStream in the code by doing




public static void sendLogonRequest(SSLSocket sslSocket)

{

try

{

OutputStream socketOutputStream = sslSocket.getOutputStream();

DataOutputStream out = new DataOutputStream(socketOutputStream);

out.write(getBytesFromFile(new File("C:\LogonRequest.xml")));

out.flush();

out.close();

}

catch (IOException ioExc)

{

System.out.println("
");

ioExc.printStackTrace();

}

}






But if I don't do "out.close()" the application seems to hang up and I got nothing on the server console, and when I do "out.close()" then I can see the content of the file on the console but the exception is raised.



Can someone know what I have to do to avoid that?





D.



PS I'm working with JDK 1.5.0_rc on Windows

   <<Less
About | Sitemap | Contact