udg Expert Licensed User Longtime User Mar 23, 2022 #1 Hi all, I'm experiencing a strange delay when executing a POST operation using standard code as below. Why strange? Because exactly the same code (it's a B4xPages project) used from the B4J counterpart takes 2 seconds at most while the B4A version waits for about 30 seconds prior to give the success response. What could it be? What would you investigate first? Code: Dim pJob As HttpJob pJob.Initialize("", Me) pJob.PostBytes(AppGlobals.hurl&"/pop",buffer) Wait For(pJob) JobDone(j As HttpJob) If j.Success Then ... ps: buffer length is only 154 bytes, so the problem should be elsewhere pps: tried both Http and Https hurls Update: I tried to insert the following line after the pjob.initialize and the delay shortened to 5 seconds. So it sound like a kind of timeout, but I can't see why it passes, since the server response looks ok (it's successful and it carries the expected data). And the initial question remains: why the delay/timeout applies only to the Android version? Code: pjob.GetRequest.Timeout = 5000 ps: shortening the timeout to 100ms everything still works ok. Taking it to <80ms raises the timeout error.
Hi all, I'm experiencing a strange delay when executing a POST operation using standard code as below. Why strange? Because exactly the same code (it's a B4xPages project) used from the B4J counterpart takes 2 seconds at most while the B4A version waits for about 30 seconds prior to give the success response. What could it be? What would you investigate first? Code: Dim pJob As HttpJob pJob.Initialize("", Me) pJob.PostBytes(AppGlobals.hurl&"/pop",buffer) Wait For(pJob) JobDone(j As HttpJob) If j.Success Then ... ps: buffer length is only 154 bytes, so the problem should be elsewhere pps: tried both Http and Https hurls Update: I tried to insert the following line after the pjob.initialize and the delay shortened to 5 seconds. So it sound like a kind of timeout, but I can't see why it passes, since the server response looks ok (it's successful and it carries the expected data). And the initial question remains: why the delay/timeout applies only to the Android version? Code: pjob.GetRequest.Timeout = 5000 ps: shortening the timeout to 100ms everything still works ok. Taking it to <80ms raises the timeout error.
LucaMs Expert Licensed User Longtime User Mar 23, 2022 #2 Setting the timeout shouldn't matter at all, since you get access. I would say the difference could be on your connections, not on B4A-B4J, as they will certainly be different, right? Upvote 0
Setting the timeout shouldn't matter at all, since you get access. I would say the difference could be on your connections, not on B4A-B4J, as they will certainly be different, right?
H Hamied Abou Hulaikah Well-Known Member Licensed User Longtime User Mar 23, 2022 #3 udg said: why the delay/timeout applies only to the Android version? Click to expand... You should check if there is firewall-related apps in your android like antivirus, also check internet connection to desalinated url & is it firewall-ed? Upvote 0
udg said: why the delay/timeout applies only to the Android version? Click to expand... You should check if there is firewall-related apps in your android like antivirus, also check internet connection to desalinated url & is it firewall-ed?
Q Quandalle Member Licensed User Mar 23, 2022 #4 You can use a REST client application on ANDROID (e.g. pocket Postman,...) to see if by passing the same request you also have a long delay Upvote 0
You can use a REST client application on ANDROID (e.g. pocket Postman,...) to see if by passing the same request you also have a long delay
KMatle Expert Licensed User Longtime User Mar 23, 2022 #5 What about the receiving side? Can you log anything? Upvote 0
Sandman Expert Licensed User Longtime User Mar 23, 2022 #6 KMatle said: What about the receiving side? Can you log anything? Click to expand... Agreed. To me it sounds like there's a timeout happening on the server when you're running the B4A code. Simply put, the connection is open for about 30 seconds. One way to test it would be to instantly have /pop return "testing" and be done with it, like as the first line of code. Your app won't be happy by that response obviously, but that's not important. We're only doing it to see how long it takes to complete the call. Upvote 0
KMatle said: What about the receiving side? Can you log anything? Click to expand... Agreed. To me it sounds like there's a timeout happening on the server when you're running the B4A code. Simply put, the connection is open for about 30 seconds. One way to test it would be to instantly have /pop return "testing" and be done with it, like as the first line of code. Your app won't be happy by that response obviously, but that's not important. We're only doing it to see how long it takes to complete the call.
udg Expert Licensed User Longtime User Mar 23, 2022 #7 Thak you all. I control the receiving end, so I can log whatever comes in and eventually compute the time it takes to prepare the response in order to compare what happens when the sending app is the B4A one rather than its B4J counterpart. Even more easily, I could use an "hello" service that's already in place on the receiving end and see what happens. Those tests will give us some more insight. ps: since the firewall hit me so many times in the past (due to its "paranoic" settings) I will check that too... Upvote 0
Thak you all. I control the receiving end, so I can log whatever comes in and eventually compute the time it takes to prepare the response in order to compare what happens when the sending app is the B4A one rather than its B4J counterpart. Even more easily, I could use an "hello" service that's already in place on the receiving end and see what happens. Those tests will give us some more insight. ps: since the firewall hit me so many times in the past (due to its "paranoic" settings) I will check that too...