[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ip local using gambas resources?
[Thread Prev] | [Thread Next]
- Subject: Re: ip local using gambas resources?
- From: Linus <olivier.cruilles@xxxxxxxx>
- Date: Sun, 23 Feb 2025 13:25:46 -0500
- To: System64 Development <64xcode@xxxxxxxxx>
- Cc: Linus <olivier.cruilles@xxxxxxxx>, user@xxxxxxxxxxxxxxxxxxxxxx
Hello,
May be this little function can help you:
Public Function getActiveNetworkInterface() As String
' Procedure to check the Active Network Cards
Dim tmpNIF As String[]
Dim tmpActive, tmpString As String
Dim iterator As Integer
Dim tmpFile As File
'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 Return tmpNIF[iterator]
Next
End
Olivier
> Le 23 févr. 2025 à 11:38, gaucho <64xcode@xxxxxxxxx> a écrit :
>
> Hi,
>
> I am using shell command to obtain the ip address but. Is there a
> gambas native method to obtain the ip address in a pc connected to a
> local network but no internet available?
>
> Thanks.
> Martin.
>
>
| Re: ip local using gambas resources? | Fabien Bodard <gambas.fr@xxxxxxxxx> |
| ip local using gambas resources? | gaucho <64xcode@xxxxxxxxx> |