dcsimg
Having problem to read vector and hashtable from ObjectInputStream.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Doris_Yang
Posted On:   Monday, June 10, 2002 08:45 PM

I write a vector and a hashtable to an ObjectOutputStream on the server side and read them from an ObjectInputStream on the client side. When the server sends the updated vector and hashtable to the client, the client can only get the old ones. It seems that the client remembers the vector and hashtable it first read from the stream. No matter what the server sends to the client later on, the client can only get the first version. Here is the code on both server and client side. Server side: case GROUPLIST_REQUEST: Vector v = server.groupnames; Hashtable h = server.groups; out[id].writeInt(GROUPLIST_REQUEST); out[id].writeObject(v); out[id].writeObject(h); out[id].flush();    More>>

I write a vector and a hashtable to an ObjectOutputStream on the server side and read them from an ObjectInputStream on the client side. When the server sends the updated vector and hashtable to the client, the client can only get the old ones. It seems that the client remembers the vector and hashtable it first read from the stream. No matter what the server sends to the client later on, the client can only get the first version. Here is the code on both server and client side.

			
Server side:

case GROUPLIST_REQUEST:
Vector v = server.groupnames;
Hashtable h = server.groups;
out[id].writeInt(GROUPLIST_REQUEST);
out[id].writeObject(v);
out[id].writeObject(h);
out[id].flush();
break;


Client side:

case GROUPLIST_REQUEST:
try
{
Vector grouplist = (Vector)in.readObject();
Hashtable groupinfo = (Hashtable)in.readObject();
}
catch (Exception e)
{
e.printStackTrace();
}
break;


Thanks.

Doris
   <<Less
About | Sitemap | Contact