--- /dev/null
+#define _POSIX_SOURCE 1
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#define BUF_SIZE 512
+
+int main(int argc, char **argv) {
+ int sock = 0;
+ int rv = 0;
+ int nread = 0;
+ struct addrinfo hints;
+ struct addrinfo *address;
+ struct addrinfo *addr_ptr;
+ char buf[BUF_SIZE];
+
+ memset(buf, 0, BUF_SIZE);
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_INET;
+ hints.ai_socktype = SOCK_STREAM;
+
+
+ rv = getaddrinfo("castor-pvt", "1210", &hints, &address);
+ if (rv != 0) {
+ fprintf(stderr, "Error looking up hostname, %d\n", errno);
+ exit(-1);
+ }
+
+
+ for (addr_ptr = address; addr_ptr != NULL; addr_ptr = addr_ptr->ai_next) {
+ sock = socket(addr_ptr->ai_family,
+ addr_ptr->ai_socktype,
+ addr_ptr->ai_protocol);
+ if (sock == -1) {
+ continue;
+ }
+
+ rv = connect(sock, addr_ptr->ai_addr, addr_ptr->ai_addrlen);
+ if (rv != -1) {
+ break;
+ }
+ close(sock);
+ }
+ if (addr_ptr == NULL) {
+ fprintf(stderr, "Could not connect\n");
+ exit(-1);
+ }
+
+ freeaddrinfo(address);
+
+ nread = read(sock, buf, BUF_SIZE-1);
+ if (nread == -1) {
+ fprintf(stderr, "read error");
+ exit(-1);
+ }
+ fprintf(stdout, "castor_load = %s", buf);
+ fprintf(stdout, "--\n");
+
+ exit(0);
+}