Accept Example for VB.NET

'LEADDICOMNet1 is a predefined LEADDicomNet object
'This example uses the predefined variable "List2" of type "ListBox" from ".NET Framework".
Private Sub LEADDICOMNet1_NetAccept(ByVal nStatus As Integer) Handles LEADDICOMNet1.NetAccept
   Dim out As String
   Dim hClient As Integer
   Dim lClients As Integer

   '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") Then
      'close the connection
      LEADDICOMNet1.Close(hClient)
   End If
End Sub