thanks Michael Morris
and sorry for delaying in replay
in the server
-------------
when i send a vector ( which carries all the IP's of connected clients ) to every client by useing a single
thread to every client
class WriteToClient extends Thread
{
public void run()
{
try
{
for(int i=0 ; i<vec2.size() ; i++)
{
Socket s=(Socket)vec2.get(i);
oos=new ObjectOutputStream(s.getOutputStream());
oos.writeObject(vec);
}
}catch(Exception e){e.printStackTrace();}
}
}
// where vec2 is a vector that holds all sockets
// where vec is a vector that holds all IP's
in the client i receive
-----------------------
java.io.StreamCorruptedException: InputStream does not contain a serialized object
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:849
)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:168)
at ChatClient$NewClientConnect.run(ChatClient.java:133)
while the Vector class implements Serializable interface
and the code fragment in the client is:
class NewClientConnected extends Thread
{
public void run()
{
try
{
while(true)
{
oos=new ObjectInputStream(s.getInputStream());
Vector vec=(Vector)oos.readObject();
}
}catch(Exception e)
{e.printStackTrace();}
}
}
and i don't know what's wrong ?
please help
Thanks in advance
--------------------
[ February 15, 2003: Message edited by: Maged Roshdy ]
[ February 15, 2003: Message edited by: Maged Roshdy ]