Hi,

When the UI of our application writes a huge data to socket, an exception is thrown. The Java thread for the same is as shown below:

at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)


On searching the internet, I have come across several of the similar types of errors
reported by various people having the same type of stack trace. Nowhere it is
mentioned clearly what solution they have appied to fix the issue.

On investigation of jre 1.5 package, I found out that the culprit function
socketWrite0 has been declared in SocketOutputStream.java.
The class SocketOutputStream.class is part of rt.jar under the directory java\net
in the jre package.

In SocketOutputStream.java, the function socketWrite0 has been declared as native
method. It's implementation has been done in the C++ as
Java_java_net_SocketOutputStream_socketWrite0 function and it is part of net.dll
provided with jre package.

In the case when the UI of our application writes only a small data to socket, no exception is thrown and it works fine.

My queries are as following:
1) How the function socketWrite0 has been implemented. What is the API method/system call that is writing to socket.
2) What is the reason of exception. If the huge size of the data is the reason, what is the limiting size?
3) What is the probable solution/workaround for this issue, if any.

Thanks and Regards
Anil Pradhan