question

yexioamu avatar image
0 Likes"
yexioamu asked Julie Weller commented

The FlexSim block when i call a remote server interface by dll functon

I create a dll function that implement the winHTTP, because my flexsim is 21.2.4 which can't modify the HTTP headers.

When I call a remote server interface by this dll, it can work, but the flexsim will block a few seconds,then recieve the response from the remote server. I search this question in this forum, i read this one( Is FlexSim thread safe?), but i can't run this module.

Could i run a separate thread to prevent the flexsim block?

FlexSim 21.2.4
blockthread
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Julie Weller avatar image Julie Weller commented ·

Hi @yexioamu, was Jordan Johnson's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Phil BoBo commented

The approach shown in the question you linked to is the right approach. You can launch a thread, and then from that thread, use PostMessage to call a function on the main thread.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Phil BoBo avatar image Phil BoBo ♦♦ commented ·

WinHTTP also has an asynchronous mode configured with a flag (WINHTTP_FLAG_ASYNC - WinHttpOpen function) and callback (WinHttpSetStatusCallback function).

0 Likes 0 ·