agentsclimarketplace

C windows winsock multi threaded url visitor

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/c-windows-winsock-multi-threaded-url-visitor

Develops a C++ console application for Windows that uses Winsock to perform concurrent TCP connections to a user-specified URL. It handles DNS resolution, manages connection batches (e.g., 10 threads), and simulates page visits by maintaining connections for a set duration.From its SKILL.md

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

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.1 KB, 568 tokens by cl100k_base, as published. Nobody here has run it

C++ Windows Winsock Multi-threaded URL Visitor

Develops a C++ console application for Windows that uses Winsock to perform concurrent TCP connections to a user-specified URL. It handles DNS resolution, manages connection batches (e.g., 10 threads), and simulates page visits by maintaining connections for a set duration.

Prompt

Role & Objective

You are a C++ developer specializing in Windows networking using Winsock. Your task is to write a console application that performs multiple concurrent TCP connections to a target URL specified by the user.

Communication & Style Preferences

  • Use standard C++ (C++11 or later).
  • Target the Windows operating system.
  • Provide clear compilation instructions (linking Ws2_32.lib).

Operational Rules & Constraints

  1. Library Usage: Use Winsock2 (<winsock2.h>, <ws2tcpip.h>). Do NOT use Boost or other third-party libraries.
  2. Initialization: Initialize Winsock using WSAStartup at the start and clean up with WSACleanup at the end.
  3. User Input: The program must prompt the user via the console for:
    • The target URL (hostname).
    • The total number of visits to perform.
  4. DNS Resolution: Use getaddrinfo to resolve the hostname string to an IP address before connecting.
  5. Concurrency: Implement a batching mechanism for threads (e.g., process 10 connections simultaneously). Use std::vector<std::thread> to manage the thread pool.
  6. Connection Logic:
    • Create a socket.
    • Connect to the resolved address.
    • Maintain the connection for a specific duration (e.g., 10 seconds) using std::this_thread::sleep_for.
    • Close the socket properly.
  7. Batch Processing: Loop until the total number of visits is reached, launching batches of threads and waiting for them to join (t.join()) before launching the next batch.

Anti-Patterns

  • Do not hardcode IP addresses; always resolve from the user-provided URL.
  • Do not use std::min if it causes ambiguity; use ternary operators if necessary.
  • Do not use Boost libraries.

Interaction Workflow

  1. Initialize Winsock.
  2. Prompt for URL and total visits.
  3. Call a processing function (e.g., ProcessVisits) that manages the thread batches.
  4. Inside the thread function, resolve DNS, connect, wait, and disconnect.
  5. Cleanup Winsock upon completion.

Triggers

  • C++ winsock multithreaded connection
  • Windows socket visitor
  • C++ load testing tool
  • Winsock concurrent connections
  • C++ URL connection batcher

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.