The task is to create a server in C/C ++ language communicating via HTTP, which will provide various information about the system such as:
- Obtaining a domain name
- Obtaining CPU name
- Current CPU load
- Ivan Tsiareshkin (xtsiar00)
- The server is compiled using the next command, which creates the hinfosvc executable.
make all
- To create .zip archive:
make pack
- To delete executable and archive:
make pack
- Obtaining a domain name
./hinfosvc 12345 & curl http://localhost:12345/hostname
or
./hinfosvc 12345 & GET http://localhost:12345/hostname
- Obtaining CPU name
./hinfosvc 12345 & curl http://localhost:12345/cpu-name
or
./hinfosvc 12345 & GET http://localhost:12345/cpu-name
- Current CPU load
./hinfosvc 12345 & curl http://localhost:12345/load
or
./hinfosvc 12345 & GET http://localhost:12345/load
An argument "12345" is indicating the local port on which server will listen for requests.