Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在DLL中使用HP-Socket时退出DLL时卡死 #269

Open
sinfee opened this issue Sep 22, 2023 · 3 comments
Open

在DLL中使用HP-Socket时退出DLL时卡死 #269

sinfee opened this issue Sep 22, 2023 · 3 comments

Comments

@sinfee
Copy link

sinfee commented Sep 22, 2023

在规则DLL中使用HP-Socket时,退出DLL时,设置了在ExitInstance函数中退出连接,调用CTcpClientPtr对象的Stop()时无法成功退出。
中断后发现函数是在WaitForMultipleObjectsWithMessageLoop中的::MsgWaitForMultipleObjects 中。

请问应该如何解决呢?

@ldcsaa
Copy link
Owner

ldcsaa commented Sep 29, 2023

你这应该是在socket线程中调用stop了。
可以通过组件的析构函数自动断开连接。

@sinfee
Copy link
Author

sinfee commented Oct 5, 2023

感谢指导。我是在一个DLL中使用HP-Socket并封装成导出的C方式函数,这个DLL是嵌入在其他应用程序中调用的,所以主程序是否在线程中调用DLL中的输出函数是没办法限制和更改调用方式的。这种方式应该如何使用HP-Socket呢?

@ldcsaa
Copy link
Owner

ldcsaa commented Oct 9, 2023

试试在 DllMain() 的 DLL_PROCESS_DETACH 事件中执行Stop。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants