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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access