Universal high-performance Windows Socket component Hp-socket v2.2.2 officially released

Source: Internet
Author: User


Hp-socket is a common set of high-performance Windows Socket component packages that contain server-side components (IOCP models) and client components (Event Select model), which are widely used in Windows platform TCP communication systems. Hp-socket the communication layer is fully encapsulated, the upper application does not need to pay attention to any details of the communication layer; Hp-socket provides an API interface based on the event notification model that can be easily and efficiently integrated into various applications; In addition, in order to make it easier for everyone to learn hp-socket, A performance Test example (Test ECHO-PFM) and a PULL Model test sample (test Echo-pull) are carefully crafted for a functional test sample (test Echo), which allows users to quickly grasp the design idea and usage of the component with these two test examples.

* Hp-socket Official website: http://www.jessma.org
* Hp-socket Download Address: https://code.google.com/p/ldcsaa/

----------------------------------------------------------------
Versatility
The only responsibility of the communication component is to receive and send the byte stream, and not to participate in the upper layer protocol parsing;
With the upper users decoupled, independent, components and users through the operator interface and listener interface to interact, component implementation interface for the upper layer to provide operational methods; The consumer implements the listener interface to register itself as the component's Listener, receiving component notifications. Therefore, any user who implements the listener interface can use the component, on the other hand, can even write a completely different implementation of the component implementation to the user invocation, as long as the component to comply with the components of the operating interface, this is the DIP design principle of the embodiment.

Availability of
Usability is critical to all common components, and it's easier to write a whole story if it's too hard to use. As a result, the component's operating interface and listener interface are designed to be as simple and easy to use (colloquially as "goofy"), with no more than 5 main methods for both interfaces. In addition, the component completely encapsulates all of the underlying Socket communications, the upper application does not see any communication details, does not have to interfere with any communication operations, and the Socket connection is abstracted as a Connection ID, which is provided as a connection ID to the upper application to identify the different connections.

Performance
As a common component at the bottom, performance issues must be considered and should never be the bottleneck of the system. On the other hand, according to the performance requirements of client components and service-side components, different Socket models are used in practice. Components are designed to take into account performance, real-world usage scenarios, availability, and implementation complexity, ensuring that performance requirements are met without being too complex to write. Make the following two-point design decisions:
Client: Socket communication interaction is implemented in a separate thread. This avoids interfering with the main thread or other threads, and the I/O model chooses the Event select communication model.
Service side: The IOCP communication model with the highest efficiency in Windows platform; Cache pooling technology, in the process of communication, often require frequent request and free memory buffer, set up a dynamic buffer pool, only when there is no available object in the cache pool to create new objects, and when too many cached objects will compress the cache pool In addition, the dynamic memory of the component is distributed through the private heap (the private Heap) mechanism, avoiding competition with the new/malloc while reducing the memory hole.

Scalability of
You can set the performance parameters of a component (such as the number of worker threads, the size of the various cache pools, the size of the receiving and sending buffers, the size of the Socket listener queue, the number of ACCEP distributions, and the heartbeat interval) based on the actual usage environment.

Update records:
v2.2.2 Update * * *
> Optimize heartbeat detection related functions:
-----------------
* The Get/setkeepalivetimes () method for Iserversocket and Iclientsocket is replaced by Get/setkeepalivetime ()
* The default KeepAliveTime property for Ciocpserver and Cclientsocket is changed to 5000
* The default KeepAliveInterval property for Ciocpserver and Cclientsocket is changed to 3000

v2.2.1 Update * * *
> PULL Model Support:
-----------------
* Isocketlistener increase PULL model data receive notification method OnReceive (dwconnid, int)
* Add PULL Socket interface Ipullsocket, the Fetch (Dwconnid, pbuffer, Ilength) method of this interface is used to crawl communication data
> Server:
-----------------
* Service Port Socket Interface Isocketserver renamed to Iserversocket
* Add PULL Server Socket Listener abstract class Cpullserversocketlistener
* Add PULL Server Socket interface Ipullserversocket
* Add PULL Server Socket implementation class Ciocppullserver
> Client:
-----------------
* Client Socket Interface isocketclient renamed to Iclientsocket
* Client Socket Implementation class Csocketclient renamed to Cclientsocket
* Add PULL Client Socket Listener abstract class Cpullclientsocketlistener
* Add PULL Client Socket interface Ipullclientsocket
* Add PULL Client Socket implementation class Cpullclientsocket
> Other updates:
-----------------
* Add PULL Socket Test program Testecho-pull
* Add several help structures to SocketHelper.h (. cpp)
> Upgrade Instructions:
-----------------
* Applications that use Hp-socket v2.1.1 can be upgraded securely to v2.2.1
* Because the names of Isocketserver, Isocketclient, and csocketclient have been modified, the application needs to modify the name of the reference and the included header file name accordingly
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.