I am writing a small chat server for one of my classes. I am using a multi-threaded client/server model so whenever a client connects a new thread is created to hold the client/server interactions, I am passing data across sockets using ObjectOutputStreams and ObjectInputStreams. I am running into an issue where some of my methods only work for the LAST client that connects, which leads me to believe that I am overwriting data somewhere I just cant seem to find where. I was hoping someone could spot my mistake.
Sorry for the long post, any ideas would be great!
"If the facts don't fit the theory, get new facts" --Albert Einstein
You didn't provide the full code therefore it's hard to say where the problem is. Also you didn't tell what particular methods does not work as expected. So I can only guess that this might be methods, which calls ChatServer.getClients() and similiar functions, i.e. static functions that return collections. The matter is that returning static Collection instance 'as is' might not work properly. To fix this problem the function should return Collection.clone().
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com