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

accept_request中直接将指针赋给client #62

Open
CodePYJ opened this issue Jul 25, 2023 · 2 comments
Open

accept_request中直接将指针赋给client #62

CodePYJ opened this issue Jul 25, 2023 · 2 comments

Comments

@CodePYJ
Copy link

CodePYJ commented Jul 25, 2023

main函数中 ”accept_request(&client_sock);“ 将地址传入。
accept_request函数中 ”int client = (intptr_t)arg;“ 将地址赋给client,将导致recv读不到数据。

@Auditor1234
Copy link

是的呢,我被这个地方卡了好久,recv()函数的返回值是-1,页面出不来就是这个问题,
需要将accept_request()函数中:

int client = (intptr_t)arg;

改成:

int client = *(int *)arg;

@Liusandian
Copy link

Liusandian commented Feb 5, 2024 via email

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