+ global_sockfd = net_open (host, port);
+ if (global_sockfd < 0)
+ {
+ ERROR ("apcups plugin: Connecting to the "
+ "apcupsd failed.");
+ return (-1);
+ }
+ }
+
+
+ status = net_send (&global_sockfd, "status", strlen ("status"));
+ if (status != 0)
+ {
+ /* net_send is closing the socket on error. */
+ assert (global_sockfd < 0);
+ if (retry)
+ {
+ retry = 0;
+ count_retries++;
+ continue;
+ }
+
+ ERROR ("apcups plugin: Writing to the socket failed.");