Hp Socket

High Performance TCP/UDP/HTTP Communication Component
Alternatives To Hp Socket
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Halfrost Field12,512
2 months ago1cc-by-sa-4.0Go
✍🏻 这里是写博客的地方 —— Halfrost-Field 冰霜之地
Dio12,1075701,4084 days ago134November 30, 202326mitDart
A powerful HTTP client for Dart and Flutter, which supports global settings, Interceptors, FormData, aborting and canceling a request, files uploading and downloading, requests timeout, custom adapters, etc.
Rathole7,06514 days ago23October 01, 202370apache-2.0Rust
A lightweight and high-performance reverse proxy for NAT traversal, written in Rust. An alternative to frp and ngrok.
Fast Android Networking5,622
a month ago243apache-2.0Java
🚀 A Complete Fast Android Networking Library that also supports HTTP/2 🚀
Hp Socket5,4591123 days ago1September 25, 201721otherC
High Performance TCP/UDP/HTTP Communication Component
Twisted5,3659,6956002 days ago98October 31, 20232,788otherPython
Event-driven networking engine written in Python.
Acl2,723
4 days ago37October 20, 202335lgpl-3.0C
A powerful server and network library, including coroutine, redis client, http, websocket, mqtt with C/C++ for multi-platform including Linux, Android, iOS, MacOS, Windows, etc..
Toxy2,70312102 years ago25November 16, 201814mitJavaScript
Hackable HTTP proxy for resiliency testing and simulated network conditions
Aioquic1,487217 days ago40November 16, 202310bsd-3-clausePython
QUIC and HTTP/3 implementation in Python
Networkeye1,299
214 years ago19September 25, 201916mitObjective-C
a iOS network debug library, monitor HTTP requests
Alternatives To Hp Socket
Select To Compare


Alternative Project Comparisons
Readme

HP-Socket

High Performance Network Framework

Description

  • Server Based on IOCP/EPOLL communication model, combined with technology of memory pool, private heap etc., efficient memory management is implemented to support large scale and high concurrent communication scenarios.
  • Agent The Agent component is essentially a Multi-Client component that uses the same technical architecture as the Server component. An Agent component object can create and efficiently handle large-scale Socket connections at the same time.
  • Client Based on Event-Select/POLL communication model, each component object creates a communication thread and manages a Socket connection. Client components are suitable for small-scale client scenarios.

Document

  • HP-Socket Development Guide [pdf]
  • HP-Socket Class Diagram [uml]
  • HP-Socket Class Diagram [jpg]
  • HP-Socket SSL Class Diagram [jpg]
  • HP-Socket HTTP Class Diagram [jpg]

Workflow

  1. Create listener object
  2. Create component object (and binding with listener object)
  3. Start component object
  4. Connect to dest host (for Agent Component only)
  5. process network events (OnConnect/OnReceive/OnClose etc.)
  6. Stop component object (optional: component object will be stopped before destroy in step 7)
  7. Destroy component object
  8. Destroy listener object

Agent Workflow

Example

  • C++ Example
#include <hpsocket/HPSocket.h>

/* Listener Class */
class CListenerImpl : public CTcpPullServerListener
{

public:
	// 5. process network events
	virtual EnHandleResult OnPrepareListen(ITcpServer* pSender, SOCKET soListen);
	virtual EnHandleResult OnAccept(ITcpServer* pSender, CONNID dwConnID, UINT_PTR soClient);
	virtual EnHandleResult OnHandShake(ITcpServer* pSender, CONNID dwConnID);
	virtual EnHandleResult OnReceive(ITcpServer* pSender, CONNID dwConnID, int iLength);
	virtual EnHandleResult OnSend(ITcpServer* pSender, CONNID dwConnID, const BYTE* pData, int iLength);
	virtual EnHandleResult OnClose(ITcpServer* pSender, CONNID dwConnID, EnSocketOperation enOperation, int iErrorCode);
	virtual EnHandleResult OnShutdown(ITcpServer* pSender);
};

int main(int argc, char* const argv[])
{
	// 1. Create listener object
	CListenerImpl s_listener;
	// 2. Create component object (and binding with listener object)
	CTcpPullServerPtr s_pserver(&s_listener);
	
	// 3. Start component object
	if(!s_pserver->Start("0.0.0.0", 5555))
		exit(1);
	
	/* wait for exit */
	// ... ... 
	
	// 6. (optional) Stop component object
	s_pserver->Stop();

	return 0;
	
	// 7. Destroy component object automatically
	// 8. Destroy listener object automatically
}
  • C Example
#include <hpsocket/HPSocket4C.h>

// 5. process network events
EnHandleResult __HP_CALL OnConnect(HP_Agent pSender, HP_CONNID dwConnID);
EnHandleResult __HP_CALL OnReceive(HP_Agent pSender, HP_CONNID dwConnID, int iLength);
EnHandleResult __HP_CALL OnSend(HP_Agent pSender, HP_CONNID dwConnID, const BYTE* pData, int iLength);
EnHandleResult __HP_CALL OnClose(HP_Agent pSender, HP_CONNID dwConnID, En_HP_SocketOperation enOperation, int iErrorCode);
EnHandleResult __HP_CALL OnShutdown(HP_Agent pSender);

int main(int argc, char* const argv[])
{
	HP_TcpPullAgentListener s_listener;
	HP_TcpPullAgent s_agent;

	// 1. Create listener object
	s_listener = ::Create_HP_TcpPullAgentListener();
	// 2. Create component object (and binding with listener object)
	s_agent    = ::Create_HP_TcpPullAgent(s_listener);
	
	/* Set listener callbacks */
	::HP_Set_FN_Agent_OnConnect(s_listener, OnConnect);
	::HP_Set_FN_Agent_OnSend(s_listener, OnSend);
	::HP_Set_FN_Agent_OnPullReceive(s_listener, OnReceive);
	::HP_Set_FN_Agent_OnClose(s_listener, OnClose);
	::HP_Set_FN_Agent_OnShutdown(s_listener, OnShutdown);
	
	// 3. Start component object
	if(!::HP_Agent_Start(s_agent, "0.0.0.0", TRUE))
		exit(1);
	
	// 4. Connect to dest host
	::HP_Agent_Connect(s_agent, REMOTE_HOST_1, REMOTE_PORT_1, nullptr);
	::HP_Agent_Connect(s_agent, REMOTE_HOST_2, REMOTE_PORT_2, nullptr);
	::HP_Agent_Connect(s_agent, REMOTE_HOST_3, REMOTE_PORT_3, nullptr);
	
	/* wait for exit */
	// ... ... 
	
	// 6. (optional) Stop component object
	::HP_Agent_Stop(s_agent);

	// 7. Destroy component object
	::Destroy_HP_TcpPullAgent(s_agent);
	// 8. Destroy listener object
	::Destroy_HP_TcpPullAgentListener(s_listener);
	
	return 0;
}

Component List

  • Basic Components

Basic Component

  • SSL Components

SSL Component

  • HTTP Components

HTTP COmponent

Reference Projects

Extension Projects

Technical Exchange Groups

Popular Network Projects
Popular Http Projects
Popular Networking Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Cpp
C
Network
Http
Websocket
Socket
Tcp
Ssl
Networking
Diagram
Udp
Https
Ndk
Epoll