Skip to content

请教一下各位大佬,./WebServer之后要怎么做 #163

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

Open
terrfg opened this issue Apr 1, 2025 · 6 comments
Open

请教一下各位大佬,./WebServer之后要怎么做 #163

terrfg opened this issue Apr 1, 2025 · 6 comments

Comments

@terrfg
Copy link

terrfg commented Apr 1, 2025

No description provided.

@Auditor1234
Copy link

Auditor1234 commented Apr 4, 2025

I have seen this project, you can use it as the following steps:

  1. Start the server:./WebServer -t 4 -p 8888 -l /data/lzr/ProgramFiles/cplusplus/WebServer/MyLog/log1.log
  2. Start the client: ./HTTPClient

Notes: as the port has been fixed in ./WebServer/tests/HTTPClient.cpp, you could not change the port in server.

@terrfg
Copy link
Author

terrfg commented Apr 4, 2025

Thank you for your explanation, I would like to ask another question! After starting the client: ./HTTPClient
the command line output:
1:
strlen(p) = 1
n=0
err2: Connection refused
err3: Connection refused
At the same time the server also output:
Segmentation fault (core dumped)

@Auditor1234
Copy link

Auditor1234 commented Apr 5, 2025

Thank you for your explanation, I would like to ask another question! After starting the client: ./HTTPClient the command line output: 1: strlen(p) = 1 n=0 err2: Connection refused err3: Connection refused At the same time the server also output: Segmentation fault (core dumped)

I think you could check if the port has been used, and select a avaliable port. In my environment, it just outputs some normal result, no Segmentation fault (core dumped).

Image

@terrfg
Copy link
Author

terrfg commented Apr 5, 2025

Thanks for your response again. I figured out the problem. After changing the index after -l, the output is normal now.

./WebServer -t 4 -p 8888 -l /data/lzr/ProgramFiles/cplusplus/WebServer/MyLog/log1.log ---> ./WebServer -t 4 -p 8888 -l /home/terrfg/log1.log

My client’s output is the same as yours.

My server outputs "Resource temporarily unavoidable"
Do you have the same output in your server?
If the output in my server is not normal, i will continue to find my problems.

@Auditor1234
Copy link

You can type chinese as I am a Chinese. As far as I know, there are two main problems in this project:

  1. As there are no html file in the build folder, you should create a index.html (where content could be anything) in the folder like that:

Image
2. You need to modify the code as follows:

Image

@terrfg
Copy link
Author

terrfg commented Apr 6, 2025

谢谢大佬的指导!!! 我想我可以继续我下一步的学习了!

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