HP-Socket Documentation

repository·dev·Indexed 27 days ago

https://github.com/ldcsaa/hp-socket

A high-performance network framework for large-scale and high-concurrency communication. It provides optimized Server, Agent, and Client components using IOCP and EPOLL. The framework supports TCP, UDP, SSL, and HTTP protocols across multiple platforms including .NET, Linux, MacOS, and Android NDK. Key features include HPSocket.Net extended components for WebSocket and port forwarding, data receive adapters for handling sticky packets, and support for HTTP or Socks5 proxies.

Tokens
21K
Snippets
16
Records
111
Agent score
91%

What's inside HP-Socket

  1. Overview of the TestEcho-SSL Client Project Structure

    dev

    The TestEcho-SSL/Client project is a Microsoft Foundation Class (MFC) based application designed to demonstrate SSL-enabled echo client functionality. The project is structured as a standard Visual C++ application with a main dialog-based interface.

    Key Components:

    • Main Application Logic: Managed by CClientApp (defined in Client.h and Client.cpp).
    • User Interface: The main dialog behavior is defined in ClientDlg.h and ClientDlg.cpp, using a template defined in Client.rc.
    • Resources: Icons and bitmaps are managed via Client.rc and res\Client.rc2.
    • Build Configuration: The project uses Client.vcxproj for Visual C++ project settings and StdAfx.h/StdAfx.cpp for precompiled headers to optimize build times.
  2. Overview of the TestEcho-Http Client Project Structure

    dev

    The TestEcho-Http/Client project is a Windows MFC (Microsoft Foundation Class) application designed to demonstrate HTTP echo client functionality. The project is structured as a standard Visual C++ application with a main dialog-based interface.

    Key Components:

    • Main Application Logic: Managed by CClientApp (defined in Client.cpp and Client.h).
    • User Interface: The main dialog behavior is defined in ClientDlg.h and ClientDlg.cpp using a template stored in Client.rc.
    • Resources: Icons and bitmaps are managed via Client.rc and Resource.h.
    • Build Configuration: The project uses Client.vcxproj for Visual C++ project settings and StdAfx.h/StdAfx.cpp for precompiled headers.
  3. Overview of the TestEcho Client Project Structure

    dev

    The TestEcho Client is a Windows-based application built using the Microsoft Foundation Class (MFC) library. It serves as a demonstration of basic client functionality within the HP-Socket ecosystem. The project structure is organized as follows:

    • Core Application: Client.cpp and Client.h contain the CClientApp application class.
    • Main Dialog: ClientDlg.h and ClientDlg.cpp define the CClientDlg class, which manages the behavior of the application's primary user interface.
    • Project Files: Client.vcxproj is the main Visual C++ project file, and Client.vcxproj.filters manages file grouping in the IDE.
    • Resources: Client.rc and Resource.h manage Windows resources like icons (res\Client.ico) and bitmaps. res\Client.rc2 is used for resources not editable by the Visual C++ resource editor.
    • Precompiled Headers: StdAfx.h and StdAfx.cpp are used to build the precompiled header (Client.pch) to improve build times.
  4. Overview of the TestEcho-Http-4C SyncClient Project

    dev
    The TestEcho-Http-4C/SyncClient is a Windows-based demonstration application built using the Microsoft Foundation Class (MFC) library. It serves as a starting point for developing synchronous client applications within the HP-Socket ecosystem, specifically demonstrating HTTP echo functionality. The project is structured as a standard Visual C++ MFC application with a main dialog-based interface.
  5. Overview of the TestEcho-Pull Client Project Structure

    dev

    The TestEcho-Pull/Client project is a Microsoft Foundation Class (MFC) based Windows application designed to demonstrate client-side functionality. The project structure is organized as follows:

    • Core Application:
      • Client.vcxproj: The main Visual C++ project file.
      • Client.h & Client.cpp: The main application header and source files containing the CClientApp class.
      • StdAfx.h & StdAfx.cpp: Precompiled header (PCH) files used to accelerate build times.
    • User Interface (Dialog):
      • ClientDlg.h & ClientDlg.cpp: Defines the CClientDlg class, which manages the behavior of the application's main dialog.
    • Resources:
      • Client.rc: The main resource script containing icons, bitmaps, and cursors.
      • Resource.h: Header file defining resource IDs.
      • res\Client.ico: The application icon.
      • res\Client.rc2: Additional resources not editable by the Visual C++ resource editor.
    • Deployment:
      • Client.manifest: Side-by-Side (SxS) assembly dependency information for Windows compatibility.
  6. Overview of the TestEcho-UDP Client Project Structure

    dev

    The TestEcho-UDP/Client project is a Microsoft Foundation Class (MFC) based application designed to demonstrate UDP echo functionality. The project structure is organized as follows:

    Core Application Files

    • Client.vcxproj: The main Visual C++ project file containing platform, configuration, and feature settings.
    • Client.h & Client.cpp: The main header and source files defining the CClientApp application class.
    • ClientDlg.h & ClientDlg.cpp: The dialog class (CClientDlg) that defines the behavior of the application's main user interface.

    Resource Files

    • Client.rc: The main resource script listing Windows resources like icons and cursors.
    • Resource.h: The standard header defining resource IDs used by Visual C++.
    • res\Client.ico: The application's icon file.
    • res\Client.rc2: Contains resources not editable by the Microsoft Visual C++ resource editor.
    • Client.manifest: Describes application dependencies on Side-by-Side assemblies for Windows compatibility.

    Build Support

    • StdAfx.h & StdAfx.cpp: Used to build precompiled header (PCH) files (Client.pch) to speed up compilation.
    • Client.vcxproj.filters: Manages how files are grouped within the IDE (e.g., grouping .cpp files under "Source Files").
  7. Overview of HP-Socket for MacOS

    dev

    HP-Socket for MacOS provides a high-performance networking library with the same callback interfaces as other platforms. Due to platform restrictions, it uses kqueue instead of epoll and DISPATCH instead of ONESHOT.

    Important Platform Requirements:

    • MacOS Version: Must be 10.12 or above (required for shared_timed_mutex in RWLock.h).
    • TCP Keep-Alive: TCP_KEEPALIVE, TCP_KEEPINTVL, and TCP_KEEPCNT are not provided normally due to platform restrictions.
  8. Overview of HP-Socket Components

    dev

    HP-Socket is a high-performance cross-platform network communication framework. It provides three primary component types depending on your use case:

    • Server: Based on IOCP/EPOLL models. Uses cache pools and private heaps for efficient memory management. Designed for ultra-large-scale, high-concurrency scenarios.
    • Agent: A Multi-Client component using the same architecture as the Server. A single Agent object can establish and efficiently handle a large number of Socket connections.
    • Client: Based on Event Select/POLL models. Each component object creates a communication thread to manage a single Socket connection. Best suited for small-scale client scenarios.
  9. Overview of the TestEcho-4C Client Project Structure

    dev

    The TestEcho-4C Client is a Windows application built using the Microsoft Foundation Class (MFC) library. It serves as a demonstration of basic MFC usage and a template for developing custom client applications. The project structure includes:

    • Core Application Logic: Client.cpp and Client.h define the CClientApp application class.
    • Main Dialog: ClientDlg.h and ClientDlg.cpp define the CClientDlg class, which controls the behavior of the application's primary user interface.
    • Resources: Client.rc and Resource.h manage Windows resources like icons (res\Client.ico), bitmaps, and cursors.
    • Build Configuration: Client.vcxproj contains the Visual C++ project settings, platforms, and configurations.
  10. HPSocket.Net Supported Frameworks and Platforms

    dev

    HPSocket.Net is a C# SDK for HP-Socket with the following compatibility:

    Supported .NET Frameworks:

    • .Net Framework 2.0+
    • .Net Core 2.0+
    • .Net 5.0
    • .Net 6.0

    Supported Platforms:

    • Windows 7+ x86/x64
    • Linux kernel 2.6.32+ x86/x64
    • mac OS 10.12+ x64 (Note: macOS support requires .net core 2.0+ and uses the libhpsocket4c.dylib compiled from the HP-Socket macOS branch).
  11. Understand the TestEcho-Http SyncClient Project Structure

    dev

    The TestEcho-Http/SyncClient project is a Microsoft Foundation Class (MFC) based demonstration application. It serves as a starting point for implementing synchronous HTTP echo client functionality. The project structure includes:

    • Core Application Logic: Client.h and Client.cpp define the CClientApp application class.
    • User Interface: ClientDlg.h and ClientDlg.cpp define the CClientDlg class, which manages the main application dialog. The dialog template is stored in Client.rc.
    • Project Configuration: SyncClient.vcxproj contains Visual C++ project settings, platforms, and configurations.
    • Resources: Client.rc and Resource.h manage Windows resources like icons (res\Client.ico) and resource IDs.
    • Precompiled Headers: StdAfx.h and StdAfx.cpp are used to speed up build times via precompiled headers.