Hp-socket is a general-purpose, high-performance tcp/udp/http communication framework that includes Server-side components, client components, and Agent components that are widely used in tcp/udp/http communication systems in a variety of scenarios, providing c/s, C #, Delphi, E (easy language), Java, Python and other programming language Interfaces. Hp-socket completely encapsulates the communication layer, the application does not have to focus on any details of the communication layer, and Hp-socket provides an API interface based on the event notification model, which can be easily and efficiently integrated into the old and new Applications.
pull model example, pack model examples, performance test examples, and other programming language examples). Hp-socket is currently running on the Windows platform and will implement Cross-platform support in the Future.
"hp-socket v4.1 Development guide"
----------------------------------------------------------------
Versatility
- Hp-socket's sole responsibility is to receive and send byte streams, not to participate in application protocol Resolution.
- Hp-socket interacts with the application through an interface and is fully decoupled. Any application can seamlessly integrate Hp-socket as long as the Hp-socket interface specification is Implemented.
Ease of Use
- Ease of use is essential for all common frameworks, and it is not as easy to write them as you would if they were too difficult. therefore, the Hp-socket interface is designed to be very simple and uniform.
- The hp-socket completely encapsulates all the underlying communication details, and the application does not have to interfere with the underlying communication operations. The communication connection is abstracted to the Connection id,connection ID as the unique identity of the connection provided to the application to handle the different connections.
- Hp-socket provides Push/pull/pack and other receive models, the application can flexibly choose to handle the package in manual, semi-automatic or fully automatic way, the Pull/pack receiving model reduces the complexity of packet processing and greatly reduces the chance of Error.
Performance
- Client Component: based on the Event Select communication model, The communication operation is performed in a separate thread to avoid interfering with the main thread or other THREADS. Each Component object manages a Socket Connection.
- Server Components: based on the IOCP communication model, combined with technology such as the cache pool, private heap, and other technologies, to support Ultra-large-scale connections, in high-concurrency scenarios to achieve efficient memory management.
- agent components: for scenarios such as proxy servers or transit servers, The server itself also initiates large-scale connections to other servers as a client, and an agent Component object can manage multiple Socket connections at the same time; agent components and server Components use the same technical architecture that can be used as client parts for a proxy server or a staging server.
Elasticity of
Applications can adjust Hp-socket performance parameters (E.G. number of worker threads, size of cache pool, send mode and receive mode, etc.) based on realistic scenarios such as different capacity requirements, communication scale and resource status, and optimize resource allocation to meet application needs without wasting resources.
(project homepage: Click here: click Here)
v4.1.2 Update * * *
> WebSocket support:
-----------------
- Add WebSocket method for all HTTP components
1) sendwsmessage (): Send WebSocket packet
2) getwsmessagestate (): Gets the current WebSocket status
- All HTTP component listeners increase the WebSocket event
1) onwsmessageheader (): WebSocket packet Header notification
2) onwsmessagebody (): WebSocket Packet Notification
3) onwsmessagecomplete (): WebSocket packet Completion notification
- example Demo testecho-http and testecho-http-4c support WebSocket
> Add HTTP Sync Client communication components:
-----------------
- http Sync Client for synchronous HTTP communication, no event listener required
- HTTP Sync Client component class: chttpsyncclient, chttpssyncclient
- HTTP Sync Client implementation interface: Itcpclient/ihttpsyncrequester
- example Demo testecho-http and testecho-http-4c provide an example of an Http Sync Client
> Other updates:
-----------------
- using new ring buffer algorithm to improve the security of asynchronous Operation
- Improving HTTP asynchronous operation security with delayed release strategy
* * * v4.0.1 UPDATE * * *
> Add HTTP Series Communication Components:
-----------------
- New HTTP Server Components
1) Component Class: chttpserver, chttpsserver
2) Implement Interface: Itcpserver/icomplexhttpresponder
3) Listener interface: Ihttpserverlistener
- New HTTP Agent Component
1) Component Class: chttpagent, chttpsagent
2) Implement Interface: Itcpagent/icomplexhttprequester
3) Listener interface: Ihttpagentlistener
- New HTTP Client Component
1) Component Class: chttpclient, chttpsclient
2) Implement Interface: Itcpclient/ihttprequester
3) Listener interface: Ihttpserverlistener
- New HTTP Sample Demo
1) testecho-http (source Code)
2) testecho-http-4c (4C lib/4c DLL)
- Http Listener
1) listener event:
2) Listener event return value (enhttpparseresult:
> Component Interface Adjustment:
-----------------
- All listener callback methods for the IServer and iagent components add the ' event source ' parameter, such as: onshutdown (), onshutdown (t* psender)
- All listener callback methods for the IClient component increase the ' connection ID ' parameter, such as: onhandshake (iclient* pclient), onhandshake (t* psender, Connid dwconnid)
- IServer and Iagent interface add interface method: Get/setmaxconnectioncount () to set the maximum number of connections, the maximum number of connections Default: 10000
- Onhandshake () Event Trigger rule adjustment: The NON-SSL component also triggers the Onhandshake () event after the OnConnect () event, making the SSL component and the SSL component processing process consistent
- Hpsocket4c adds a method for creating and destroying pack component listeners, and the new version must create and destroy pack component listeners using the following methods:
1) Create_hp_tcppackserverlistener/destroy_hp_tcppackserverlistener
2) Create_hp_tcppackagentlistener/destroy_hp_tcppackagentlistener
3) Create_hp_tcppackclientlistener/destroy_hp_tcppackclientlistener
- SSL Components Support SNI
1) SSL Initialization Method hp_ssl_initialize (), Add SNI callback function pointer parameter
2) New method Hp_ssl_addservercontext () for loading SNI host certificate
> Other updates:
-----------------
- IServer and Iagent components use Ring Pool instead of r/w Lock + MAP to maintain active connections for improved read-write and concurrency performance
- Update all Demo sample code
* * * v3.5.1 UPDATE * * *
> Add SSL Series Communication Components:
-----------------
- new SSL PUSH components: csslserver, csslagent, csslclient
- new SSL Pull components: csslpullserver, csslpullagent, csslpullclient
- new SSL PACK components: csslpackserver, csslpackagent, csslpackclient
- ssl Server implements Itcpserver interface, SSL Agent implements Itcpagent interface, SSL Client implements Itcpclient interface
- you need to call the Hp_ssl_initialize () function to initialize the SSL Global environment parameter before starting the SSL communication component
- Call the Hp_ssl_cleanup () function to clean up the SSL Global runtime environment after communication ends
- New SSL-related Example Demo:
1) testecho-ssl (source code) 2) testecho-ssl-pack (dll/4c DLL) 3) testecho-ssl-4c (4C lib) 4) TESTECHO-SSL-PFM (lib)
> Component Interface Adjustment:
-----------------
- Itcpserverlistener interface increased SSL handshake success Event: Onhandshake (connid Dwconnid)
- Itcpagentlistener interface increased SSL handshake success Event: Onhandshake (connid Dwconnid)
- Itcpclientlistener interface increased SSL handshake success Event: Onhandshake (iclient* Pclient)
- Enumeration type Ensocketerror add ' SSL Environment not ready ' error code Se_ssl_env_not_ready
- Add enumeration type: Ensslsessionmode (ssl operating mode), ensslverifymode (SSL authentication Mode)
- Hpsocket-ssl DLL Primary Header file: Socketinterface-ssl.h,hpsocket-ssl.h
- Hpsocket4c-ssl DLL Primary Header file: Hpsocket4c-ssl.h
- TCP Pack Series components can be set to a maximum package length adjustment of 4194303/0x3fffff bytes
- The effective header identification value range of TCP Pack series components is adjusted to 0 ~ 1023/0X3FF
> Add Static Library Project:
-----------------
- New Project Engineering Hpsocketlib and HPSOCKETLIB4C for compiling hpsocket and hpsocket4c static libraries
- Static libraries are used in the same way as dynamic libraries (refer to examples demo:testecho-ssl-4c and Testecho-ssl-pfm)
- When working with Hpsocket or hpsocket4c static libraries, you need to define the preprocessing macros, and so on in the project properties Hpsocket_static_lib
- The static library destination file is not included in the release package (because it is too large), and if necessary, compile it yourself
v3.4.4 Update * * *
> Add TCP Pack Series Communication components:
-----------------
- The TCP Pack Series component guarantees that each OnReceive event provides a complete packet to the application
- TCP Pack Series components are a combination of the Push/pull pattern, where applications do not have to process subcontracting (E.G. PUSH) and data fetching (E.G. Pull)
- The TCP Pack Series components provide the Get/setmaxpacksize () and Get/setpackheaderflag () methods to set the maximum packet length and header identification
- Ctcppackserver implements Itcpserver interface, Ctcppackagent implements Itcpagent interface, Ctcppackclient implements Itcpclient interface
> Component Interface Adjustment:
-----------------
- Onclose/onerror merged into one communication event: OnClose (connid dwconnid, ensocketoperation enoperation, int Ierrorcode)
- Enumeration Type Ensocketoperation adds an enumeration value: So_close = 5, Identifies the close Socket operation
- IServer and Iagent interface removal interface method: Get/setrecvpolicy ()
- IServer and Iagent interface removal interface method: Get/setmaxshutdownwaittime ()
> Bug fixes:
-----------------
- Fix the TCP Pack Agent "asynchronous connection failure causes program crash" Bug
- Fix vc-common-src Common code package Ccasqueue may cause an infinite loop Bug
High performance tcp/udp/http communication framework Hp-socket v4.1.2