Spinach.AsynchronousClient.SendMultiClientChat C# (CSharp) Method

SendMultiClientChat() public method

public SendMultiClientChat ( ) : void
return void
        public void SendMultiClientChat()
        {
            try
            {
                if (table.Count > 0)
                {
                    int count = 0;
                    resetEvent = new ManualResetEvent[table.Count];
                    foreach (string IPPort in table.Keys)
                    {
                        resetEvent[count] = new ManualResetEvent(false);
                        Peer mPeer = (Peer)table[IPPort];
                        string ip = mPeer.mIP;
                        int port = Int32.Parse(mPeer.mPort);
                        BroadcastClient temp = new BroadcastClient(ip, port, MultiMsg);
                        ThreadPool.QueueUserWorkItem(new WaitCallback(temp.StartClient), (object)count);
                        count++;
                    }
                    foreach (WaitHandle w in resetEvent)
                    {
                        w.WaitOne();
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        private void ConnectCallback(IAsyncResult ar)