Android Question Chance of socket error?

kostefar

Active Member
Licensed User
Longtime User
Dear All,

In an app where the user manually submits data using httpjob to the server and receives feedback from the same at random times, I also have a timer that fires an event every 5 seconds, connecting to the server to check if new data is available.
If the user submits data at the same time as the timer event fires, would that possibly cause a conflict? I know that in vb6, you´d get winsock is not ready or something like that.

Thanks in advance!
 

mc73

Well-Known Member
Licensed User
Longtime User
Not sure if a conflict may happen, but if you want to be sure, why not set a flag to warn the timer that user is sending data? This way, the timer, may proceed when this flag is set to false (sending data is finished). Same way, when timer is searching for data, put a flag to delay a bit the sent data from user. Anyway, before such attempt, I would go for testing sending and receiving by creating a loop to see the results.
 
Upvote 0

kostefar

Active Member
Licensed User
Longtime User

Thanks mc73, I was also thinking about this in case there could be such conflicts.

An alternative would be if more than one socket can be opened, like in vb6. Is this a possibility with vbx?

EDIT: Seems so! https://www.b4x.com/android/forum/threads/multiple-sockets-at-the-same-time.35676/
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…