Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

object streams

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
In the client part of a chatprogram i want to be able to recieve multiple types of objects from the input stream. the code i have kinda works.

String from, msg, tempMSG;
Vector tempClientData;
Object tempObject;

while (running) {
try {
tempObject=in.readObject();
listener.messageReceived("Server", tempObject.toString(), this); //this displays the object to the client. It is the original vector not the new one? I don't understand?

try {
tempMSG=(String) tempObject;

StringTokenizer token=new StringTokenizer(tempMSG, ">>>>");
if(token.countTokens()==2) {
from=token.nextToken();
msg=token.nextToken();
listener.messageReceived(from, msg, this);
}
} catch(Exception e) {
tempClientData=(Vector) tempObject;
userList.updateList(tempClientData);
}
} catch(Exception e) {
e.printStackTrace();
stopRunning();
}
}

it works fine the first time the vector is sent over, but when another vector is sent to replace it, it receives the same vector(or think it receives the same vector). I have done all the testing possible on the server side of the application and it is sending the updated vector.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top