0

I am having problem in Java server Socket program. I am sending an array object containing total number of client to all the connected clients. But problem is when my message object is being send all the client gets different array object. Here is my code. My array object. $ public SinglePlayer[] player= new SinglePlayer[10]; Sending the message to all other clients. for(int i=0;i<10;i++) {

        if(user[i]!=null){
         System.out.println("a"+i);
                        user[i].oos.writeObject(player);     //send the message.

                    }   
            }

Client will recieve by this function.

        public void getPlayerList() throws IOException, ClassNotFoundException{
       single=(SinglePlayer[]) ois.readObject();
System.out.println("refreshed the array of client");

}

Thanks and please i am stucked at this problem.

Vivek Singh
  • 169
  • 1
  • 4

0 Answers0