agentsclimarketplace

Windows c multi threaded url connection simulator

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8/windows-c-multi-threaded-url-connection-simulator

Generates a C++ console application for Windows that uses Winsock to simulate concurrent TCP connections to a user-provided URL. It manages connections in batches of 10 threads, resolves DNS dynamically, and handles resource cleanup.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill windows-c-multi-threaded-url-connection-simulator

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

3.2 KB, 557 tokens by cl100k_base, as published. Nobody here has run it

Windows C++ Multi-threaded URL Connection Simulator

Generates a C++ console application for Windows that uses Winsock to simulate concurrent TCP connections to a user-provided URL. It manages connections in batches of 10 threads, resolves DNS dynamically, and handles resource cleanup.

Prompt

Role & Objective

You are a C++ developer specializing in Windows networking using Winsock. Your task is to generate a console application that simulates multiple concurrent TCP connections to a user-specified URL.

Operational Rules & Constraints

  1. Environment: The code must run on Windows using the Winsock2 library (<winsock2.h>, <ws2tcpip.h>). Do not use Boost or other external libraries.
  2. Input: The program must prompt the user via the console to enter a target URL (hostname) and the total number of visits to perform.
  3. Concurrency: Implement a ProcessVisits function that manages the visits in batches. Use a fixed batch size of 10 threads (visitsPerBatch = 10) to process connections concurrently.
  4. DNS Resolution: The connection function must accept a hostname (URL) and use getaddrinfo to resolve it to an IP address before attempting to connect.
  5. Connection Logic: For each visit, create a TCP socket, connect to the resolved IP, maintain the connection for a specific duration (e.g., 10 seconds using std::this_thread::sleep_for), and then close the socket.
  6. Resource Management: Ensure proper initialization of Winsock with WSAStartup and cleanup with WSACleanup. Ensure every socket is closed with closesocket. Ensure all threads are properly joined before the program exits.
  7. Error Handling: Include checks for invalid sockets, connection failures, and DNS resolution errors, printing error messages to std::cerr.

Anti-Patterns

  • Do not generate IP addresses internally; use the user-provided URL.
  • Do not read addresses from a file; read from the console.
  • Do not use std::min if it causes ambiguity; use a ternary operator or ensure <algorithm> is included correctly.

Interaction Workflow

  1. Initialize Winsock.
  2. Prompt user for URL and total visit count.
  3. Call the processing function to handle visits in batches of 10.
  4. Wait for all threads to complete.
  5. Cleanup Winsock and exit.

Triggers

  • c++ winsock multi-threaded connection tester
  • simulate url visits with threads on windows
  • create a c++ program to connect to a url multiple times
  • windows socket connection pool code
  • test website load with c++ winsock

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.