We recently set up an RD Gateway for an alternate access path for those clients who are firewalled 3389 on their end. So far so good. Except that we can't seen to get their correct remote IP address. Code above returns some wacky and incorrect IP addresses. We know that the real IP address is there somewhere because we can see it on the RD Gateway server role Monitoring properties.
Private Declare Function WTSQuerySessionInformation Lib "wtsapi32.dll" _ Alias "WTSQuerySessionInformationA" (ByVal hServer As Long, ByVal SessionID As Long, _ ByVal WTSInfoClass As Long, ByRef ppBuffer As Long, ByRef pBytesReturned As Long) As Long lRet = WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSCLIENTADDRESS, ppBuffer, pBytesReturned)
From novice to tech pro — start learning today.