Overview
HS Sockets is a C source code library for interfacing to network socket layer. HS Sockets runs on Windows desktop OS (XP,Vista,7), Windows Mobile OS and on Linux OS. HS Sockets is supplied with full C source code and binaries for these platforms
HS Sockets optionally supports secure network sockets using OpenSSL library
HS Sockets hides the complexity of low level socket api from user application, enabling the programmer to considerably reduce development time.
HS Sockets operates in an asynchronous, non-blocking mode and support multiple TCP client and server connections and UDP sessions concurrently
The use of HS Sockets C Source Library is Royalty Free.
Features
- TCP and UDP sessions
- Supports multiple sessions operating concurently
- Supports multiple client and multiple server sessions concurrently
- Asyncronous non-blocking operation
- Source code for Windows, Windows Mobile and Linux OS
- Optional support for secure sockets using OpenSSL
- Hostname to IP address resolution
- Retrieve local connection info: hostname, IP address, local port
- Configurable socket read buffer size
- Flow control: enable / disable reading from a socket
- IP address 32 bit to string and vice versa conversion
How It Works
After the user application initializes HS Sockets library with HsSockInit it can now estalish TCP client or server sessions or UDP sessions
When acting as a TCP client, the applicatoin calls HsSockTcpConnect supplying the event callback function. HsSockTcpConnect returns immediately. The application then processes HS Sockets event notifications within the event callbacj function. Once TCP connection is accepted by server, HS_SOCK_EV_CONNECTED is received and the applicatoin can send and receive data
When acting as a TCP server, the application calls HsSockTcpListen supplying the event callback function. Again, HsSockTcpListen returns immediatly. New incoming TCP connections are indicated via the event callback.
When acting as a UDP peer, the application calls HsSockUdpOpen supplying the event callback function
To send data the application simply calls HsSockTcpSend or HsSockUdpSendto
The received data are passed up to the application via the event callback
Internally, HsSock uses non-blocking sockets and two threads, one for listening sessions (server sessions) and one for active socket sessions (either connecting or connected)
API Summary
- HsSockInit
- HsSockCleanUp
- HsSockUdpOpen
- HsSockTcpConnect
- HsSockTcpListen
- HsSockTcpSend
- HsSockUdpSendto
- HsSockClose
- HsSockSetReadSize
- HsSockSetReadEnabled
- HsSockTcpSwitchToSecureMode
- HsSockTcpCheckSecureHandshakeDone
- HsSockTcpCheckPeerCertSimple
- HsSockInetNtoa
- HsSockInetAddr
- HsSockGetDomain
- HsSockGetHostIpByName
- HsSockGetLocalAddress
Secure Sockets Implementation Details
Support for SSL / TLS is implemented in HsSock library using OpenSSL toolkit.
HsSock library has a compile option to incude SSL support or not. If SSL support is compiled in, HsSock library interfaces to OpenSSL API in order to manage SSL connections, secure negotiation and data encryption and decryption.
SSL support is optional and it is possible to use HS Sockets without OpenSSL. To do that HsSock compile option must be changed not to include SSL support.
* This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit
Customization
Hillstone Software provides additional services for customization, porting and integration of the library code to better suit the needs of your products
