Buenos dias señores,
Como hago para detectar el IP FIXO de un compturadora??
Gracias,
Regards, saludos.
karinha wrote:Como hago para detectar el IP FIXO de un compturadora??
FUNCTION cLocalIp()
local cIp := ""
if WSaStartup() == 0
cIp := ServerIp()
WSaCleanUp()
endif
RETURN(cIp)
FUNCTION cPublicIP()
Local cBuffer, cRequest, cResponse, nBytes, pSocket
IF IsInternet()
INetInit()
pSocket := INetConnect( "checkip.dyndns.org", 80 )
IF INetErrorCode( pSocket ) <> 0
RETURN( "Socket error:" + INetErrorDesc( pSocket ) )
INetCleanUp()
QUIT
ENDIF
nBytes := INetSend( pSocket, "GET / HTTP/1.1" + CRLF + "Host: checkip.dyndns.org" + CRLF + "User-Agent: HTTP-Test-Program" + CRLF + CRLF )
cBuffer := Space(512)
cResponse:= ""
WHILE ( nBytes > 0 )
nBytes := INetRecv( pSocket, @cBuffer )
cResponse += Left( cBuffer, nBytes )
cBuffer := Space(512)
ENDDO
INetClose( pSocket )
INetCleanUp()
ELSE
RETURN("0.0.0.0")
ENDIF
RETURN( allTrim( substr( substr( cResponse, rat( "<body>", cResponse ) + 26 ), 1, At( "<", substr( cResponse, rat( "<body>", cResponse ) + 26 ) ) - 1 ) ) )
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 69 guests