HTTPCommunication

In Chapter 3, we saw how the HTTPCommunication class is used to control all access to and from a network. Now, we will revisit that class to create a method that determines whether a PC has a working network connection. The code required is shown in Figure 22-7.

The {has-connection} method first creates an instance of the Curl system class DataTCPSocket and stores this in the local socket variable. The {constructor} for DataTCPSocket has many settings that affect the type of socket it will manage, and as you can see in Figure 22-7, we only specify a few configuration parameters.

remote-address specifies which remote address to connect to, and we define this using the SocketInetAddress class, which is a Curl system class that ...

Get Enterprise Curl now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.