对了我是这样的! int Lenth;
String Uname;
ClientList Cl;//序列化对象
Lenth=SL.getSize();
for(int i=0;i<Lenth;i++)
{
try
{
Cl=(ClientList)SL.elementAt(i);
//fromClient = new ObjectInputStream(Cl.Client.getInputStream());
toClient = new ObjectOutputStream(Cl.Client.getOutputStream());
toClient.writeObject(SL);
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"发送在线用户列表发生错误(Server)"+e);
} }我是先把一个客户端和服务器建立好的Socket对象和这个客户名称放到一个序列化对象ClientList 中,然后在把ClientList放到Vector对象中,再循环查找Vector中已经连接的所有可户端发送已登陆的客户名称!我这样写不知道是否正确!请教高手!100分不够再加!
String Uname;
ClientList Cl;//序列化对象
Lenth=SL.getSize();
for(int i=0;i<Lenth;i++)
{
try
{
Cl=(ClientList)SL.elementAt(i);
//fromClient = new ObjectInputStream(Cl.Client.getInputStream());
toClient = new ObjectOutputStream(Cl.Client.getOutputStream());
toClient.writeObject(SL);
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"发送在线用户列表发生错误(Server)"+e);
} }我是先把一个客户端和服务器建立好的Socket对象和这个客户名称放到一个序列化对象ClientList 中,然后在把ClientList放到Vector对象中,再循环查找Vector中已经连接的所有可户端发送已登陆的客户名称!我这样写不知道是否正确!请教高手!100分不够再加!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货