Accept Example for C#

//This example uses the predefined variable “List2” of type “ListBox” from “.NET Framework”.
//This example uses the predefined variable “LEADDICOMNet1” of type “LEADDicomNet” from “"LEADTOOLS Toolkit”.

private void LEADDICOMNet1_NetAccept(int nStatus)
{
    string Out = null;
   int hClient = 0;
   int lClients = 0;
   //accepting the connection attempt
   LEADDICOMNet1.Accept();
   //get the latest client lClients = LEADDICOMNet1.GetClientCount(LEADDICOMNet1.hNet);
   hClient = LEADDICOMNet1.GetClient(LEADDICOMNet1.hNet, lClients - 1);
   //display some information about the connection: Out = "Peer: " + LEADDICOMNet1.GetPeerAddress(hClient);
   List2.Items.Add("Connection Accepted - " + Out);
   //reject the connection if we don't like the address
   if (LEADDICOMNet1.GetPeerAddress(hClient) == "207.238.49.199")
   {
      //close the connection
      LEADDICOMNet1.Close(hClient);
   }
}