B4R Question how to return ip from in line c

mzelecom

Member
how can i return IPAddress from in line c.
this is my code.not work
B4X:
Sub Process_Globals
        Dim ip() As Byte
End Sub

Sub get_ip (name() As Byte)
    ip=RunNative("getip", name)
    
End Sub


#If c
#include <ESPmDNS.h>

void getip(B4R::Object* o)
{
B4R::Array* b = (B4R::Array*)B4R::Object::toPointer(o);
char* c = (char*)b->data;
IPAddress serverIp = MDNS.queryHost(c);

return serverIp;
}

#end if
 

Daestrum

Expert
Licensed User
Longtime User
This line

B4X:
void getip(B4R::Object* o)

Defines the function as void. The void means don't return anything - so you will need to change it to B4R::Object* (or some other data type) to actually get it to return a value.
 
Upvote 0
Top