title: Winsock Multi Clients on C#
body: <p>I have a task to make a simple winsock chat program that use VB.6 as the client and C# as the server.
  It works well when it is with one client. But I have trouble how it can handle multiple clients. Can any body help me please? I searched in google but I hardly found the answer.  Thx</p>
  
  <p>Here is my code</p>
  
  <p>When connection request come:</p>
  
  <pre><code>    private void sckMain_ConnectionRequest(object sender, AxMSWinsockLib.DMSWinsockControlEvents_ConnectionRequestEvent e)
      {
          sckMain.Close();
          sckMain.Accept(e.requestID);
          IsConnect = true;
  
          //lstSocket = new List&lt;clsSocket&gt;();
          //runTCP();
          //sckMain.Close();
          //with this commands we accept the connection request to the server..
          //now we are connected with the client
          txtHistory.Text += "Client Connected :" + sckMain.RemoteHostIP + Environment.NewLine;
      }
  </code></pre>
  
  <p>When receive data</p>
  
  <pre><code>    private void sckMain_DataArrival(object sender, AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent e)
      { //ON DATA ARRIVAL
          string data = "";
          object objData = (object)data;
          sckMain.GetData(ref objData);
          data = objData.ToString();
          txtHistory.Text += "[" + sckMain.RemoteHostIP + "]: " + data + Environment.NewLine;
      }
  </code></pre>