Android Question B4A B4J communications

saeed10051

Active Member
Licensed User
Longtime User
I have used Network library to send data from my B4A app on my mobile to my desktop running a B4J app. A custom data type can be send this way using wifi connection. I need to know which library / method i can use to communicate between my B4A app and B4J app over the internet. I am considering that my B4J app is online all the time and i am outside some where with my mobile having an internet connection.
 

saeed10051

Active Member
Licensed User
Longtime User
Hi Erel, I have tried using web socket for this communication. It is working fine when my laptop and my mobile are connected to same wifi. But when i use my data package on my mobile and laptop is on wifi, the mobile app tries to connect but connection doesnt work.
 
Upvote 0

saeed10051

Active Member
Licensed User
Longtime User
Hi Erel, i am getting following error on B4A side while running above mentioned apps

java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/methods/HttpPost;

while on B4J side i am getting followIng warning, however in the last line it says that Update duckdns: OK

WARNING: Invalid cookie header: "Set-Cookie: AWSALBCORS=NW3AZyuLsxzg2ww3aLr6eWFGdHx8UKPK/bAtmb0pqTG/loSYUYz8soURIGeNA1RGW98Gvv2aIuL0CUnNdG3iRO/xy33w7bwcpZlLC2lNrsq8zBC5fTcMWCNtI9Ci; Expires=Thu, 07 May 2020 13:42:32 GMT; Path=/; SameSite=None". Unable to parse expires attribute: Thu, 07 May 2020 13:42:32 GMT
 
Upvote 0

saeed10051

Active Member
Licensed User
Longtime User
The actual code doesn't matter. It explains the steps that you need to do in order to make a direct connection over the internet.
Hi Erel,
when i run the B4J side of the code, i get following in my log
Update DuckDNS: OK
as per the code if j.success = true then i will be getting this message in the log.
This shows that the server side is working
when i write 127.0.0.1:54021/test in the browser
i get Your ip address: 127.0.0.1
however when i run yourdomain.duckdns.org:54021/test with my domain name that i have set on duckdns, it gives me error, this site cant be reached
i have configured my router as per attached file for port forwarding, here i have given same port name i.e. 54021
dont know where i am going wrong. Also i beleive i need to make change in the B4A code on following line, i have updated it like this
also when i see my ip address in duckdns it is different than the one i get when i run ipconfig on my system. I have updated the ip on duckdns also but doesnt work.
i am not sure if i need to make any changes to the following code, here it is a key value pair and in the ip key the value is empty. do i need to give my ip address here
B4X:
Sub UpdateIp_Tick
    Dim j As HttpJob
    j.Initialize("j", Me)
    j.Download2("http://www.duckdns.org/update", Array As String("domains", domain, "token", token, _
        "ip", ""))
End Sub
 

Attachments

  • orbi.jpg
    orbi.jpg
    133 KB · Views: 264
Upvote 0
Top