Index: /vtcross/branches/trnewman/CR_shell/src/main_cognitive_engine.cpp
===================================================================
--- /vtcross/branches/trnewman/CR_shell/src/main_cognitive_engine.cpp	(revision 67)
+++ /vtcross/branches/trnewman/CR_shell/src/main_cognitive_engine.cpp	(revision 67)
@@ -0,0 +1,139 @@
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <iostream>
+
+using namespace std;
+
+struct CE_Info {
+    int numUtilities;
+    int numParameters;
+    int numObservables;
+};
+
+struct Utility {
+    char name[20];
+    char units[20];
+    char goal[20];
+   /* string name;
+    string units;
+    string goal;*/
+    float target;
+};
+
+struct Affect {
+    Utility * u; 
+    //string relation;
+    char relation[20];
+};      
+
+struct Parameter {
+    /*string name;
+    string units;*/
+    char name[20];
+    char units[20];
+    float min;
+    int numAffects; 
+    Affect affection_list[10];
+    float max;
+    float step;
+};      
+        
+struct Observable {
+    //string name;
+    char name[20];
+    Affect affection_list[10];
+    int numAffects;
+};
+
+// error handling
+void error(char *msg)
+{
+    perror(msg);
+    exit(0);
+}
+
+// main client socket
+int main(int argc, char *argv[])
+{
+    int sockfd, portno, n;
+    struct sockaddr_in serv_addr;
+    struct hostent *server;
+
+    // create a socket
+    char buffer[256];
+    if (argc < 3) {
+       fprintf(stderr,"usage %s hostname port\n", argv[0]);
+       exit(0);
+    }
+    portno = atoi(argv[2]);
+    sockfd = socket(AF_INET, SOCK_STREAM, 0);
+    if (sockfd < 0) 
+        error("ERROR opening socket");
+    server = gethostbyname(argv[1]);
+    if (server == NULL) {
+        fprintf(stderr,"ERROR, no such host\n");
+        exit(0);
+    }
+    bzero((char *) &serv_addr, sizeof(serv_addr));
+    serv_addr.sin_family = AF_INET;
+    bcopy((char *)server->h_addr, 
+         (char *)&serv_addr.sin_addr.s_addr,
+         server->h_length);
+    serv_addr.sin_port = htons(portno);
+    // cast sockaddr_in to sockaddr
+    if (connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0) 
+        error("ERROR connecting");
+    /*if (connect(sockfd,&serv_addr,sizeof(serv_addr)) < 0) 
+        error("ERROR connecting");*/
+    
+    printf("Please enter the message: ");
+    bzero(buffer,256);
+    fgets(buffer,255,stdin);
+    n = send(sockfd,buffer,strlen(buffer),MSG_NOSIGNAL);
+    if (n < 0) 
+         error("ERROR writing to socket");
+    bzero(buffer,256);
+    
+    // read back xml information
+    int counter, i;
+    Utility * uList[10];
+    Parameter * pList[10];
+    Observable * oList[10];
+    CE_Info *ce_info;
+
+    // read unitilities
+    // numUtilities
+    bzero(buffer,256);
+    n = recv(sockfd,buffer,255,0);
+    if (n < 0) 
+         error("ERROR reading from socket");
+    printf("%s\n",buffer);
+    ce_info->numUtilities = atoi(buffer);
+    printf("number of utilities: %d\n", ce_info->numUtilities);
+        
+    /*bzero(buffer,256);
+    n = recv(sockfd,buffer,255,0);
+    printf("%s ", buffer);*/
+    
+    //for (i = 0; i < ce_info->numUtilities; i++){
+    for (i = 0; i < 1; i++){
+        bzero(buffer,256);
+        n = recv(sockfd,buffer,255,0);
+        if (n < 0) 
+            error("ERROR reading from socket");
+        printf("%s ", buffer);
+        strcpy(uList[i]->name, buffer);
+    }
+
+    //for (i = 0; i < ce_info->numUtilities; i++){
+    /*for (i = 0; i < 1; i++){
+        printf("%s ", uList[i]);
+    }*/
+    printf("\n");
+
+
+    return 0;
+}
Index: /vtcross/branches/trnewman/CR_shell/src/main_client.c
===================================================================
--- /vtcross/branches/trnewman/CR_shell/src/main_client.c	(revision 67)
+++ /vtcross/branches/trnewman/CR_shell/src/main_client.c	(revision 67)
@@ -0,0 +1,110 @@
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h> 
+
+struct CE_Info {
+    int numUtilities;
+    int numParameters;
+    int numObservables;
+};
+
+struct Utility {
+    char name[20];
+    char units[20];
+    char goal[20];
+   /* string name;
+    string units;
+    string goal;*/
+    float target;
+};
+
+struct Affect {
+    Utility * u; 
+    //string relation;
+    char relation[20];
+};      
+
+struct Parameter {
+    /*string name;
+    string units;*/
+    char name[20];
+    char units[20];
+    float min;
+    int numAffects; 
+    Affect affection_list[10];
+    float max;
+    float step;
+};      
+        
+struct Observable {
+    //string name;
+    char name[20];
+    Affect affection_list[10];
+    int numAffects;
+};
+
+// error handling
+void error(char *msg)
+{
+    perror(msg);
+    exit(0);
+}
+
+// main client socket
+int main(int argc, char *argv[])
+{
+    int sockfd, portno, n;
+    struct sockaddr_in serv_addr;
+    struct hostent *server;
+
+    char buffer[256];
+    if (argc < 3) {
+       fprintf(stderr,"usage %s hostname port\n", argv[0]);
+       exit(0);
+    }
+    portno = atoi(argv[2]);
+    sockfd = socket(AF_INET, SOCK_STREAM, 0);
+    if (sockfd < 0) 
+        error("ERROR opening socket");
+    server = gethostbyname(argv[1]);
+    if (server == NULL) {
+        fprintf(stderr,"ERROR, no such host\n");
+        exit(0);
+    }
+    bzero((char *) &serv_addr, sizeof(serv_addr));
+    serv_addr.sin_family = AF_INET;
+    bcopy((char *)server->h_addr, 
+         (char *)&serv_addr.sin_addr.s_addr,
+         server->h_length);
+    serv_addr.sin_port = htons(portno);
+    if (connect(sockfd,&serv_addr,sizeof(serv_addr)) < 0) 
+        error("ERROR connecting");
+    
+    printf("Please enter the message: ");
+    bzero(buffer,256);
+    fgets(buffer,255,stdin);
+    n = write(sockfd,buffer,strlen(buffer));
+    if (n < 0) 
+         error("ERROR writing to socket");
+    bzero(buffer,256);
+    
+    // read back xml information
+    int counter;
+    Utility * uList[10]
+    Parameter * pList[10];
+    Observable * oList[10];
+    CE_Info ce_info;
+
+    // read unitilities
+    // numUtilities
+    n = read(sockfd,buffer,255);
+    if (n < 0) 
+         error("ERROR reading from socket");
+    printf("%s\n",buffer);
+    ce_info->numUtilities = atoi(buffer);
+    printf("number of utilities: %d\n", ce_info->numUtilities);
+
+    return 0;
+}
