Dear friends, please for help,
I get IP address:
And I want to save this IP xxx.xxx.xxx.xxx address as GLOBAL
I am trying
this is functioned...but I dont know if that is good direction how to do it..
because IP address can be f.e. 192.145.3.5 or 192.168.137.15
and I must recognized if declaration is Dim cbt(3) As Byte or Dim cbt(2) As Byte or Dim cbt(1) As Byte
then I want to use this received IP for sending pockets via UDP:
Please for advice what is the best way for saving IP address as GLOBAL and I think that later I will save it to eeprom.
Thank you very much
p4ppc
I get IP address:
B4X:
ip1() As Byte
Log ("Received IP:", ip1(0),".", ip1(1),".", ip1(2),".", ip1(3) )
And I want to save this IP xxx.xxx.xxx.xxx address as GLOBAL
I am trying
B4X:
Dim firstipnumber As String = ip1(0)
Log(GlobalStore.Slot0,"-", ip1(0)) 'get the value from IP1(0)
Dim ipsaved as String
Dim cbt(3) As Byte
byteconvert.ArrayCopy2(GlobalStore.Slot0,0,cbt,0,3)
ipsaved= byteconvert.StringFromBytes(cbt)
Log("ipsaved=",ipsaved)
If firstipnumber =ipsaved Then
Log("****Same IP was received")
Else
Log("****It is differnet IP", "- and this value go to Global:",GlobalStore.Slot0)
GlobalStore.Put(0,firstipnumber) 'store value in slot #0
End If
this is functioned...but I dont know if that is good direction how to do it..
because IP address can be f.e. 192.145.3.5 or 192.168.137.15
and I must recognized if declaration is Dim cbt(3) As Byte or Dim cbt(2) As Byte or Dim cbt(1) As Byte
then I want to use this received IP for sending pockets via UDP:
B4X:
usocket.BeginPacket(ip, port)
usocket.Write("value1")
usocket.SendPacket
Please for advice what is the best way for saving IP address as GLOBAL and I think that later I will save it to eeprom.
Thank you very much
p4ppc
Last edited: