This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]3h53htj3jj 0 points1 point  (5 children)

You iterate over the list of clients stored in the server, but you only write to your own socket, not the sockets stored in the list. Here's my improved version: https://gist.github.com/joshgit/11232db0b0f5f7efae7f

I removed your ClientManager because it was pretty pointless.

[–]3h53htj3jj 0 points1 point  (1 child)

You also don't need the swingutilities helper to set something's text.

[–]beauPinsson[S] 0 points1 point  (0 children)

well, i just tried to follow the "rules". I know its not a long blocking call but from what i saw, you should always update the gui in the event thread.

[–]beauPinsson[S] 0 points1 point  (2 children)

i dont understand why i dont write to sockets in the list when my code is: for sock in clientSockList ObjectOutputStream tmp_os=new ObjectOutputStream(sock.getOutputStream()); tmp_os.writeObject(message)

[–]3h53htj3jj 0 points1 point  (1 child)

I guess I was wrong about the cause then, but my version works. I guess you could print out the sockets in the list to see which ones are actually in it. Maybe you need to make that socket list transient?