[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: Fabien Bodard <gambas.fr@xxxxxxxxx>
- Date: Sun, 23 Feb 2025 22:35:46 +0100
- To: user@xxxxxxxxxxxxxxxxxxxxxx
- Cc: System64 Development <64xcode@xxxxxxxxx>, Linus <olivier.cruilles@xxxxxxxx>
Exec ["hostname", "-I"] to sRet
Le dim. 23 févr. 2025 à 19:25, Linus <olivier.cruilles@xxxxxxxx> a écrit :
> 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.
> >
> >
>
>
>
| ip local using gambas resources? | gaucho <64xcode@xxxxxxxxx> |
| Re: ip local using gambas resources? | Linus <olivier.cruilles@xxxxxxxx> |