WebServer icon indicating copy to clipboard operation
WebServer copied to clipboard

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

Open terrfg opened this issue 8 months ago • 6 comments

terrfg avatar Apr 01 '25 12:04 terrfg

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.

Auditor1234 avatar Apr 04 '25 10:04 Auditor1234

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)

terrfg avatar Apr 04 '25 12:04 terrfg

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

Auditor1234 avatar Apr 05 '25 06:04 Auditor1234

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.

terrfg avatar Apr 05 '25 12:04 terrfg

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

Auditor1234 avatar Apr 05 '25 13:04 Auditor1234

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

terrfg avatar Apr 06 '25 13:04 terrfg