How to check if TeamViewer session is active
This function can be used to determine if current user session has active TeamViewer connection. The only way I found so far is to check specific port for established connection using netstat
netstat -nb | find ":5938" | find "ESTABLISHED"
If anything found - Teamviewer is running on PC
netstat -nb | find ":6039" | find "ESTABLISHED"
If anything found - Teamviewer session is active
Using this code GetTcpTable: Local Machine TCP Connection Table you can make TeamviewerSessionIsActive() function, just replace With TcpRow block with following:
Public Function TeamviewerSessionIsActive() As Boolean
…
With TcpRow
If ntohs(.dwRemotePort) = 6039 And & _
.dwState = MIB_TCP_STATE_ESTAB Then
TeamviewerSessionIsActive = True
Exit Function
End If
End With
…
End Function
0 Comments:
Post a Comment
<< Home