in reply to Re: sharing variables with threads
in thread sharing variables with threads

would it work if i shared the $line variable, so that everyone would see what everyone is typing?

Replies are listed 'Best First'.
Re: Re: Re: sharing variables with threads
by jasonk (Parson) on Mar 13, 2003 at 02:05 UTC

    No, you are not going to be able to do it the way you are attempting, you will have to keep a list of client connections, and every time you get a line from one client, go through the list and send it to every other client. This would actually work better without threads, using a server that sets all the clients to be non-blocking.


    We're not surrounded, we're in a target-rich environment!
      i was thinking of doing it that way, but i didnt exactly know what i would be grabbing, i figured it would just be throwing the $client variable into an array each time a new connection was made, but when i tried it it didn't work.