Computersmith64 Well-Known Member Licensed User Longtime User Feb 23, 2017 #1 I have a B4J server running that I want to sent a message to from a B4A app, then have the server respond with a Firebase Cloud Message (FCM). I've tested the FCM between the server & client app & it all works fine - however the problem I'm having is that when I try to connect to the B4J server from the B4A app using HttpJob.PostString, nothing happens for a while, then I get the following message in the log: Error: org.apache.http.conn.ConnectTimeoutException: Connect to .. timed out Click to expand... Both the device that the B4A app is running on & the PC that the B4J server is running on are connected to my local network. If I go into Chrome & type in: http://192.168.1.7:50144/message Click to expand... The B4J app log shows me that a connection has been made, however when I execute: Code: Copy Dim j As HttpJob j.Initialize("send string", Me) j.PostString(link, request) from the B4A app, I get the connection timeout message. The "link" parameter in the PostString call is a global string variable set to "http://192.168.1.7:51044/message" & I have verified that this is correct by copying & pasting it into Chrome & seeing that it connects with the server. Any ideas why Chrome connects but the app times out? Fyi, I have tried using localhost & 127.0.0.1 & they both work in Chrome, but fail in the app (with a connection refused message). Thanks - Colin.
I have a B4J server running that I want to sent a message to from a B4A app, then have the server respond with a Firebase Cloud Message (FCM). I've tested the FCM between the server & client app & it all works fine - however the problem I'm having is that when I try to connect to the B4J server from the B4A app using HttpJob.PostString, nothing happens for a while, then I get the following message in the log: Error: org.apache.http.conn.ConnectTimeoutException: Connect to .. timed out Click to expand... Both the device that the B4A app is running on & the PC that the B4J server is running on are connected to my local network. If I go into Chrome & type in: http://192.168.1.7:50144/message Click to expand... The B4J app log shows me that a connection has been made, however when I execute: Code: Copy Dim j As HttpJob j.Initialize("send string", Me) j.PostString(link, request) from the B4A app, I get the connection timeout message. The "link" parameter in the PostString call is a global string variable set to "http://192.168.1.7:51044/message" & I have verified that this is correct by copying & pasting it into Chrome & seeing that it connects with the server. Any ideas why Chrome connects but the app times out? Fyi, I have tried using localhost & 127.0.0.1 & they both work in Chrome, but fail in the app (with a connection refused message). Thanks - Colin.
Erel B4X founder Staff member Licensed User Longtime User Feb 23, 2017 #2 Have you opened port 50144 (TCP) in Windows firewall? Upvote 0
Computersmith64 Well-Known Member Licensed User Longtime User Feb 23, 2017 #3 Erel said: Have you opened port 50144 (TCP) in Windows firewall? Click to expand... Hi Erel, I hadn't, but I have now & it still times out. EDIT: It turns out that it is a firewall problem, however setting up rules to open the port doesn't fix it. The only way I can get it to work is to turn off the public profile on Windows Firewall. EDIT 2: Well after much screwing around with the inbound rules on the firewall, I was able to get it working. Not really sure how, because as far as I can tell the custom rule is set up as I had it in the past - but it's working now. - Colin. Last edited: Feb 24, 2017 Upvote 0
Erel said: Have you opened port 50144 (TCP) in Windows firewall? Click to expand... Hi Erel, I hadn't, but I have now & it still times out. EDIT: It turns out that it is a firewall problem, however setting up rules to open the port doesn't fix it. The only way I can get it to work is to turn off the public profile on Windows Firewall. EDIT 2: Well after much screwing around with the inbound rules on the firewall, I was able to get it working. Not really sure how, because as far as I can tell the custom rule is set up as I had it in the past - but it's working now. - Colin.