+int send_message_fd(int fd, const char *msg, char **reply)
+{
+ int result;
+
+ result = send(fd, msg, strlen(msg), 0);
+ if(result == -1) {
+ PERROR("send");
+ return -1;
+ }
+
+ if(!reply)
+ return 0;
+
+ *reply = (char *) malloc(MSG_MAX+1);
+ result = recv(fd, *reply, MSG_MAX, 0);
+ if(result == -1) {
+ PERROR("recv");
+ return -1;
+ }
+
+ (*reply)[result] = '\0';
+
+ return 0;
+}
+