Sobes.tech
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:

  1. Read two URLs (they can be set in the code or passed via command line arguments).
  2. Launch two requests in parallel (using threads, goroutines, async/await, or any other concurrency mechanism supported by the chosen language).
  3. Wait for both requests to complete.
  4. 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).