[xSocket-develop] Need help on xsocket
Status: Inactive
Brought to you by:
grro
|
From: Gaurav S. <Gau...@ar...> - 2010-09-14 07:39:07
|
Hi,
I have implemented a Java application and running it on Solaris machine. In that application, I am running XSOCKET server on a specified port (say X). The code snippet is as follows:
========================================================================================================
1> int port = X;
/* open a socket connection */
2> InetSocketAddress addr = new InetSocketAddress(<IP address of Solaris machine>, <port>);
3> Socket = new Socket (); // java.net.Socket.Socket()
4> socket.connect (addr, timeout); // socket is an XSOCKET
/* open I/O streams for objects */
5> OutputStream os = socket.getOutputStream(); // java.io.OutputStream
6> ObjectOutputStream oos = new ObjectOutputStream(os); // java.io.ObjectOutputStream
7> InputStream is = socket.getOutputStream(); // java.io.InputStream
8> ObjectInputStream ois = new ObjectInputStream(is); // java.io.ObjectInputStream
// write the objects to the server
9> oos.writeObject(getCommand());
10> oos.flush();
/* read object from the server (blocking operation) */
11> response = (CommandObjectResponse) ois.readObject();
========================================================================================================
After 10 consecutive execution of the application, the code gets stuck at line number 8 where we are creating an object of ObjectOutputStream.and gives following exception -
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2228)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2694)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:761)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:277)
Also when we try to close ois object, we get Null pointer exception. Do you have any idea of what could be the reason that the code gets stuck after few executions?
Appreciate your help.
Thanks in advance,
Gaurav
________________________________
"DISCLAIMER: This message is proprietary to Aricent and is intended solely for the use of the individual to whom it is addressed. It may contain privileged or confidential information and should not be circulated or used for any purpose other than for what it is intended. If you have received this message in error, please notify the originator immediately. If you are not the intended recipient, you are notified that you are strictly prohibited from using, copying, altering, or disclosing the contents of this message. Aricent accepts no responsibility for loss or damage arising from the use of the information transmitted by this email including damage from virus."
|