How do you sync many things?

See if I can explain these things…

I have a software in Xojo that’s suppose to “talk” with at least two other websites. This works.
I now know how to sync the information when using HTTPSocket ant pageRecieved.

In previous situations, I used the timer and the thread to sync different things. It worked.
But now I wonder, can I combine pageRecived inside a thread and the thread will wait until the pagedRecieved is finished?
I tried to put many request to the pageRecieved in one button, but only the last code was triggered.

I know, this is a foggy question… But with some imagination it may be clear enough?

Yes. If you supply the optional Timeout parameter, the HTTPSocket will wait until the request has finished and return the result directly, without going through PageReceived.

[quote=168258:@Jakob Krabbe]See if I can explain these things…

I have a software in Xojo that’s suppose to “talk” with at least two other websites. This works.
I now know how to sync the information when using HTTPSocket ant pageRecieved.

In previous situations, I used the timer and the thread to sync different things. It worked.
But now I wonder, can I combine pageRecived inside a thread and the thread will wait until the pagedRecieved is finished?
I tried to put many request to the pageRecieved in one button, but only the last code was triggered.

I know, this is a foggy question… But with some imagination it may be clear enough?[/quote]

The problem is you seem to have a lot of trouble grasping the two ways httpsocket works.

What I showed you with PageReceived is the asynchronous way. You launch a get request, and the httpsocket works asynchronously (sort of in its own thread), then the PageReceived event happens when it is finished. When the queue is over, you must do something in PageReceived to inform your program it has finished getting all the pages.

The synchronous way is achieved by adding a timeout value, and it returns the content in a string :

Mystring = http.Get("www.xojo.com", 30)

This one you can cram in a thread in a long series of statements. We are not talking events, here. As long as the page is not finished loading the code will stop until MyString receives the data. The PageReceived event is not used.

It may be simpler for you to grasp.

For instance, you could do in the Run event of your thread

String1 = http.Get("www.xojo.com", 30) String2 = http.Get("www.fontmenu.com", 30) String3 = http.Get("www.google.com", 30) Threadfinished = True // Windows property

In your button, all you need to do is :

MyThread.Run

Now to synchronize to the last page, monitor ThreadFinished in a timer until it turns true.