iOS Question Server.GetMyWifiIP in IOS

DickD

Active Member
Licensed User
I'm converting my android app to ios and am using wifi to share data between phones. The first code shown below works on android to get my ip address but on ios if says that "Server NewConnection Sub not found." It wasn't necessary to have one in this case on android but I went ahead and added one in the ios app but the sub is never triggered. How do I get my ip address in ios?

B4X:
'This works on android
Server.initialize(5500,"Server")
MyIP = Server.GetMyWifiIP
log("MyIP = " & MyIP)
Server.close

B4X:
Server.initialize(5500,"Server")
...
'I added this sub in ios but it is never triggered
Sub Server_NewConnection (Successful As Boolean, NewSocket As Socket)
If Successful = True Then
Log("WIFI connection successful")
MyIP = Server.GetMyWifiIP
Log("MyIP = " & MyIP)
Server.close
Else
Log("WIFI connection FAILED")
End If
End Sub
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

DickD

Active Member
Licensed User
If are only using ServerSocket to get the ip address then you don't need to initialize iz.


Can you post the exact message from the logs?

Network example: https://www.b4x.com/android/forum/threads/b4x-network-asyncstreams-b4xserializator.72149/#content
The exact error message is: "server_newconnection:: event not found". However I was able to get this to work by providing an empty Sub. See code below:

B4X:
Server.Initialize(5500,"Server")
MyIP = Server.GetMyWifiIP
log("MyIP = " & MyIP)
Server.close
...
Sub Server_NewConnection(Success as Boolean, NewSocket as Socket)
End Sub
 
Upvote 0
Top