Junior — Senior
Concurrent HTTP requests and status code display
livecode
Task condition
It is necessary to write a program that simultaneously sends HTTP requests to two specified URLs and outputs the response status codes for each request.
Approximate working algorithm:
- Read two URLs (they can be set in the code or passed via command line arguments).
- Launch two requests in parallel (using threads, goroutines, async/await, or any other concurrency mechanism supported by the chosen language).
- Wait for both requests to complete.
- For each request, output a line like
URL: <address> – status: <code>.
It is important to ensure that the requests are actually executed simultaneously, not sequentially, and to properly handle possible network errors (for example, display an error message instead of the status code).