+static int client_connect(struct private_client_data *pcd)
+{
+ int ret;
+
+ pcd->fd = -1;
+ ret = makesock(AF_UNSPEC, IPPROTO_TCP, 0, pcd->conf.hostname_arg,
+ pcd->conf.server_port_arg);
+ if (ret < 0)
+ return ret;
+ pcd->fd = ret;
+ pcd->status = CL_CONNECTED;
+ ret = mark_fd_nonblocking(pcd->fd);
+ if (ret < 0)
+ goto err_out;
+ pcd->task.pre_select = client_pre_select;
+ pcd->task.post_select = client_post_select;
+ pcd->task.private_data = pcd;
+ sprintf(pcd->task.status, "client");
+ register_task(&pcd->task);
+ return 1;
+err_out:
+ close(pcd->fd);
+ pcd->fd = -1;
+ return ret;
+}
+
+/**
+ * open connection to para_server
+ *
+ * \param argc usual argument count
+ * \param argv usual argument vector
+ * \param pcd_ptr points to dynamically allocated and initialized private client data
+ * upon successful return
+ *
+ * Check the command line options given by \a argc and argv, set default values
+ * for user name and rsa key file, read further option from the config file.
+ * Finally, establish a connection to para_server.
+ *
+ * \return Positive on success, negative on errors.
+ */
+int client_open(int argc, char *argv[], struct private_client_data **pcd_ptr)