Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Socket.shutdownOutput() closes socket inside Oracle JVM
Dear friends,
We have a java class which uses the Socket class. Our class does a Socket.shutdownOutput() to indicate that the sending of data is over and the reply may start. It works just fine outside Oracle, but when the class is loaded in the database the shutdownOutput() method apparently causes the socket to be closed. Below is a sample of the code and its output. The user has JAVAUSERPRIV and JAVASYSPRIV granted, and I even tried JAVA_ADMIN without success. The Oracle versions tested were 10.2.0.1 (Windows) and 10.2.0.2 (AIX). Does anybody know what can be happening ? Thanks in advance.
Code:
/****************************************************/
Socket sockICM = new Socket("192.168.1.133", 5010);
byte byxml[] = hmapICM.toXMLString().getBytes();
System.out.println("1");
InputStream isXmlOut = sockICM.getInputStream();
sockICM.getOutputStream().write(byxml);
System.out.println("1.5");
sockICM.shutdownOutput();
System.out.println("socket.isOutputShutdown(): " +
sockICM.isOutputShutdown());
System.out.println("socket.isClosed(): " + sockICM.isClosed());
System.out.println("2");
byte b[] = new byte[1000];
InputStream isXmlOut = sockICM.getInputStream();
System.out.println("3");
ByteArrayOutputStream bos = new ByteArrayOutputStream();
System.out.println("4");
try
{
int q;
while((q = isXmlOut.read(b)) != -1)
{
bos.write(b, 0, q);
System.out.println("leu: " + bos.toString());
}
}
catch(Exception io){
System.out.println("err=" + io.toString());
}
/****************************************************/
Output:
/****************************************************/
1
1.5
socket.isOutputShutdown(): true
socket.isClosed(): false
2
3
4
err=java.net.SocketException: Socket is closed
/****************************************************/
Received on Tue Mar 20 2007 - 09:03:43 CDT
![]() |
![]() |