Re: Como Puedo Obtener La Dirección Ip De La Maquina Local Com Gambas3
Amigos mientras mas estudio este lenguaje mas me enamoro de gambas3 y de Lunix;;; qui les dejo la forma en que pude resolver con el apoyo de la referencia que me brindo el amigo.
Dim tmpNIF As String[]
Dim tmpActive, tmpString As String
Dim iterator As Integer
Dim tmpFile As File
Dim ipaddr As String
Dim ipaddrt As String
ipaddrt = ""
ipaddr = ""
'get the interface directories
tmpNIF = Dir("/sys/class/net")
'check each folder's oper file to see if the interface is up and running
For iterator = 0 To tmpNIF.Count - 1
tmpString = "/sys/class/net" &/ tmpNIF[iterator] &/ "operstate"
'check the operational state of each interface
tmpFile = Open tmpString For Input
While Not Eof(tmpFile)
Line Input #tmpFile, tmpActive
Wend
Close #tmpFile
'if it's reported as up then return it's name
If tmpActive = "up" Then
Print tmpNIF[iterator]
Shell "ip -4 addr show " & tmpNIF[iterator] & " | grep inet" To ipaddr
Print ipaddr
ipaddrt = ipaddrt & " | " & ipaddr
Endif
Next
Message(ipaddrt)
Reporté en Gambas-it.org una discusión, aparecida en la Mailing List oficial de
gambas, sobre el tema que tu escribes:
http://www.gambas-it.org/smf/index.php?topic=3097.0
(idioma: en inglés))