Ciao a tutti,
ho una macchina windows xp che ha spesso delle connessioni RDP attive on altre macchine. Devo monitorare le connessioni e segnalare quando alcune diventano inattive o si sloggano.

Non ho idea di come poter fare.

Ho provato con Netstat che mi permette di monitorare gli IP Remoti e le connessioni tramite la porta 3389. Il problema è che appena lancio rdp senza loggarmi la connessione 3389 risulta già attiva.

Avete suggerimenti ? Io uso questo codice


Dim PropIp As IPGlobalProperties
Dim EndPoint() As IPEndPoint
Dim ConTcp() As TcpConnectionInformation

Try
PropIp = IPGlobalProperties.GetIPGlobalProperties()
EndPoint = PropIp.GetActiveTcpListeners()
ConTcp = PropIp.GetActiveTcpConnections()
For Each info As TcpConnectionInformation In ConTcp
ListBox1.Items.Add("Indirizzo Locale : " & info.LocalEndPoint.Address.ToString() & ":" & _
info.LocalEndPoint.Port.ToString() & " – " & _
"Indirizzo Remoto : " & info.RemoteEndPoint.Address.ToString() & " – " & _
info.RemoteEndPoint.Port.ToString() & " – Stato : " & info.State.ToString())

If info.RemoteEndPoint.Address.ToString() = IP_Num And info.RemoteEndPoint.Port = Porta_Destinazione_1 Then
If info.State = TcpState.Established Then Con_X_1 = True
End If


Next


Catch ex As Exception
MessageBox.Show(ex.Message)
End Try