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

UDP Server程序,在有的系统中tb_socket_urecv会一直返回0 #215

Closed
wzhy opened this issue Jun 28, 2023 · 9 comments
Closed

UDP Server程序,在有的系统中tb_socket_urecv会一直返回0 #215

wzhy opened this issue Jun 28, 2023 · 9 comments

Comments

@wzhy
Copy link

wzhy commented Jun 28, 2023

tbox版本是最新版1.7.3,开发平台是Visual Studio 2017,电脑是Windows 7_64bit,仿照tbox自带的Demo程序,使用协程API编写了一个UDP Server程序,只是单纯的接收数据。
最初一切正常,但是重装了系统(还是Windows 7_64bit)后,就出现无法收到数据的问题,断点跟进去发现tb_socket_urecv一直返回0。
换了台相同硬件配置的电脑,全新安装了Windows 10_64bit(版本号2022H2),情况一样,tb_socket_urecv一直返回0。但是在另外一台Windows10_64bit(版本号2020)上,同样的程序又能正常收数。再找一台不同硬件配置的电脑,安装Windows 10_64bit(版本号2022H2),tb_socket_urecv还是一直返回0。
所有电脑的驱动都安装齐全,没有病毒。用微软自家的Process Monitor监视程序进程的网络状态。是可以看到有UDP数据进来的。
不知道有没有遇到过类似情况?怎么定位的?怎么解决的?
谢谢!

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: UDP Server program, in some systems tb_socket_urecv will always return 0

The tbox version is the latest version 1.7.3, the development platform is Visual Studio 2017, and the computer is Windows 7_64bit. Like the Demo program that comes with tbox, a UDP Server program is written using the coroutine API to simply receive data.
Everything was normal at first, but after reinstalling the system (still Windows 7_64bit), there was a problem that the data could not be received. The breakpoint followed up and found that tb_socket_urecv always returned 0.
I changed to a computer with the same hardware configuration, and installed Windows 10_64bit (version number 2022H2), the situation is the same, tb_socket_urecv always returns 0. But on another Windows 10_64bit (version number 2020), the same program can receive data normally. Find another computer with different hardware configuration, install Windows 10_64bit (version number 2022H2), tb_socket_urecv still returns 0 all the time.
All computer drivers are fully installed and free of viruses. Use Microsoft's own Process Monitor to monitor the network status of the program process. It can be seen that there is UDP data coming in.
I don't know if you have encountered a similar situation? How is it positioned? How did you solve it?
Thanks!

@waruqi
Copy link
Member

waruqi commented Jun 28, 2023

没遇到过,你可以跟下源码。。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Never encountered, you can follow the source code. .

@wzhy
Copy link
Author

wzhy commented Jul 8, 2023

没遇到过,你可以跟下源码。。

这个问题我跟进源码也没看出来原因。
后来我把单独在另外一个目录下的tbox源码用xmake编译成静态库后,把库和头文件拷贝到我的Visual Studio解决方案中,问题消失了。
发现还是tbox.config.h跟构建tbox时发生了变化,跟 #211 差不多是一样的情况……
我这个解决方案本身也是xmake生成的,本来是把tbox的源码放到其中,以一种子项目的形式存在。
既然已经遇到了两次,感觉还是有些东西没搞清楚。那么我什么样的操作会引起tbox.config.h部分内容发生改变呢?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


If you haven’t encountered it before, you can follow the source code. .

I followed up the source code and didn't see the reason for this problem.
Later, after I compiled the tbox source code in another directory into a static library with xmake, I copied the library and header files to my Visual Studio solution, and the problem disappeared.
It is found that tbox.config.h has changed from when building tbox, the same situation as #211...
My solution itself is also generated by xmake. The tbox source code was originally placed in it and exists in the form of a sub-project.
Now that I have encountered it twice, I still feel that there are still some things that I haven't figured out. So what kind of operation will cause some content of tbox.config.h to change?

@waruqi
Copy link
Member

waruqi commented Jul 8, 2023

xmake.lua 配置有改动,或者 xmake project 生成 vs 工程时候,都会触发重新配置。。

不建议在 vs 里面直接构建 tbox。。走 xmake 编译后,xmake install -o 导出库和头文件使用。。或者走 add_requires 包管理

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


When the xmake.lua configuration is changed, or when the xmake project generates a vs project, reconfiguration will be triggered. .

@wzhy
Copy link
Author

wzhy commented Jul 9, 2023

xmake.lua 配置有改动,或者 xmake project 生成 vs 工程时候,都会触发重新配置。。

这两个情况我是知道的,但是在我这里我没有再改动过xmake.lua,也没有重新生成VS工程,建好解决方案后只使用VS菜单中的“生成解决方案”、“清理解决方案”等操作,感觉应该和这些操作无关;
当然我也会修改项目的属性配置,比如“C/C++”->“代码生成”等选项,不知道是不是跟这些操作有关?

不建议在 vs 里面直接构建 tbox。。走 xmake 编译后,xmake install -o 导出库和头文件使用。。或者走 add_requires 包管理

我后来用的就是“xmake install -o 导出库和头文件使用”这种方法,好使。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


When the xmake.lua configuration is changed, or when the xmake project generates a vs project, it will trigger reconfiguration. .
I know these two situations, but I have not changed xmake.lua here, nor have I regenerated the VS project. After building the solution, I only use the "Generate Solution" and "Clean Solution" in the VS menu. " and other operations, it feels that it should have nothing to do with these operations;
Of course, I will also modify the property configuration of the project, such as "C/C++" -> "Code Generation" and other options. I don't know if it is related to these operations?

It is not recommended to build tbox directly in vs. . After compiling with xmake, xmake install -o exports libraries and header files for use. . Or go add_requires package management
I later used the "xmake install -o export library and header file use" method, which worked.

@wzhy wzhy closed this as completed Jul 15, 2023
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

3 participants