Sockets overview

You can create socket transports that facilitate communication between clients and servers. Before doing so you can review how HCL OneTest API provides access to OSI application and transport layers.

Application layer

The application layer is the highest layer in the OSI model that contains the application-layer protocols that define the rules that software applications use to exchange data. For example, web browsers communicate with web servers by using HTTP (Hypertext Transfer Protocol), while email applications communicate by using the SMTP (Simple Mail Transfer Protocol) and POP3 (Post Office Protocol) protocols.

HCL OneTest API provides support for the application layer by packetizing the data that it receives before making it available as individual messages to subscription-based actions within a test.

Transport layer

The transport layer oversees the delivery of data from a process on one computer to a process on another computer. Transport layer protocols act as liaisons between the application layer protocols and the services that are provided by the network, there are two supported by HCL OneTest API.

User Datagram Protocol

The User Datagram Protocol (UDP) is a connectionless and thus unreliable transport protocol. It performs little error checking and does not add anything to IP services except to provide process-to-process communication instead of host-to-host communication.

UDP is a simple protocol with minimum overhead. If a process wants to send a small message and does not care much about reliability, it can use UDP. Sending a message by using UDP takes much less time than using TCP.
Note: UDP is a convenient protocol for multimedia and multicasting applications.

Transmission Control Protocol

Transmission Control Protocol (TCP) is a reliable but complex transport-layer protocol. TCP adds connection-oriented features and reliability to IP.

TCP is a reliable, stream delivery service that guarantees delivery of a data stream that is sent from one host to another without duplication or lost data. Since packet transfer is not reliable, a technique that is known as positive acknowledgment with retransmission is used to guarantee reliability of packet transfers. This fundamental technique requires the receiver to respond with an acknowledgment message as it receives the data.

The sender keeps a record of each packet it sends, and waits for acknowledgment before you send the next packet. The sender also keeps a timer from when the packet was sent, and retransmits a packet if the timer expires. The timer is needed in case a packet becomes lost or corrupted.

Client or server designation

With sockets, you must specify which end of the two processes initiates the conversation (the client) and which process waits for its peer to start (the server).

Connections

The connection from one peer to another is established, that is, initiated by a client or accepted by a server, only when a test-based publisher or subscriber is run in HCL OneTest API. The connection must exist during the test and is shared by all subsequent messaging operations within the same test sequence. If the test sequence runs a child test, the connection is passed to the child so that it can communicate with the same peer.