Index: vtcross/branches/trnewman/CR_shell/src/main_cognitive_engine.cpp
===================================================================
--- vtcross/branches/trnewman/CR_shell/src/main_cognitive_engine.cpp	(revision 70)
+++ vtcross/branches/trnewman/CR_shell/src/main_cognitive_engine.cpp	(revision 71)
@@ -25,7 +25,7 @@
 
 struct Affect {
-    Utility * u; 
+    Utility u; 
     //string relation;
-    char relation[20];
+    char relation[50];
 };      
 
@@ -61,10 +61,10 @@
     n = recv(socket,buffer,256,MSG_PEEK);
     for(i=0;i<256;i++){
-	if(strcmp(&buffer[i],"\0") == 0) break;
+	    if(strcmp(&buffer[i],"\0") == 0) break;
     }
     n = recv(socket,buffer,i+1,0);
     if (n < 0) 
          error("ERROR reading from socket");
-    //printf("ReadMessage:%s %d\n",buffer,n);
+//    printf("ReadMessage:%s %d\n",buffer,n);
 }
 
@@ -102,5 +102,5 @@
         error("ERROR connecting");
     
-    int i;
+    int i, j;
     Utility uList[10];
     Parameter pList[10];
@@ -117,31 +117,113 @@
     for (i = 0; i < ce_info.numUtilities; i++){
         bzero(buffer,256);
-	ReadMessage(sockfd,buffer);
-	printf("Name: %s\n", buffer);
+	    ReadMessage(sockfd,buffer);
+	    printf("Name: %s\n", buffer);
         strcpy(uList[i].name, buffer);
                  
         bzero(buffer,256);
-	ReadMessage(sockfd,buffer);
-	printf("Units: %s\n", buffer);
+	    ReadMessage(sockfd,buffer);
+	    printf("Units: %s\n", buffer);
         strcpy(uList[i].units, buffer);
 
         bzero(buffer,256);
-	ReadMessage(sockfd,buffer);
+	    ReadMessage(sockfd,buffer);
         printf("Goal: %s\n", buffer);
         strcpy(uList[i].goal, buffer);
         
-	bzero(buffer,256);
-	ReadMessage(sockfd,buffer);
+	    bzero(buffer,256);
+	    ReadMessage(sockfd,buffer);
         printf("Target: %s\n", buffer);
         uList[i].target = atof(buffer);
     }
 
-    //for (i = 0; i < ce_info->numUtilities; i++){
-    /*for (i = 0; i < 1; i++){
-        printf("%s ", uList[i]);
-    }*/
-    printf("\n");
-
-
-    return 0;
+    // read parameters
+    // numParameters
+    bzero(buffer,256);
+    ReadMessage(sockfd,buffer);
+    ce_info.numParameters = atoi(buffer);
+    printf("number of parameters: %d\n", ce_info.numParameters);
+        
+    for (i = 0; i < ce_info.numParameters; i++){
+        bzero(buffer,256);
+	    ReadMessage(sockfd,buffer);
+	    printf("Name: %s\n", buffer);
+        strcpy(pList[i].name, buffer);
+                 
+        bzero(buffer,256);
+	    ReadMessage(sockfd,buffer);
+	    printf("Units: %s\n", buffer);
+        strcpy(pList[i].units, buffer);
+
+        bzero(buffer,256);
+	    ReadMessage(sockfd,buffer);
+        printf("Min: %s\n", buffer);
+        pList[i].min = atof(buffer);
+        
+        bzero(buffer,256);
+	    ReadMessage(sockfd,buffer);
+        printf("Max: %s\n", buffer);
+        pList[i].max = atof(buffer);
+        
+	    bzero(buffer,256);
+	    ReadMessage(sockfd,buffer);
+        printf("Step: %s\n", buffer);
+        pList[i].step = atof(buffer);
+    
+        // numAffects
+        bzero(buffer,256);
+        ReadMessage(sockfd,buffer);
+        pList[i].numAffects = atoi(buffer);
+        printf("number of affects: %d\n", pList[i].numAffects);
+        
+        for (j = 0; j < pList[i].numAffects; j++){
+            bzero(buffer,256);
+	        ReadMessage(sockfd,buffer);
+	        printf("Utility name: %s\n", buffer);
+            strcpy(pList[i].affection_list[j].u.name, buffer);
+                 
+            bzero(buffer,256);
+	        ReadMessage(sockfd,buffer);
+	        printf("Relation: %s\n", buffer);
+            strcpy(pList[i].affection_list[j].relation, buffer);
+        }
+
+    }
+    
+    // read obervables
+    // numParameters
+    bzero(buffer,256);
+    ReadMessage(sockfd,buffer);
+    ce_info.numObservables = atoi(buffer);
+    printf("number of observables: %d\n", ce_info.numObservables);
+        
+    for (i = 0; i < ce_info.numObservables; i++){
+        bzero(buffer,256);
+	    ReadMessage(sockfd,buffer);
+	    printf("Name: %s\n", buffer);
+        strcpy(pList[i].name, buffer);
+                 
+        // numAffects
+        bzero(buffer,256);
+        ReadMessage(sockfd,buffer);
+        oList[i].numAffects = atoi(buffer);
+        printf("number of affects: %d\n", oList[i].numAffects);
+        
+        for (j = 0; j < oList[i].numAffects; j++){
+            bzero(buffer,256);
+	        ReadMessage(sockfd,buffer);
+	        printf("Utility name: %s\n", buffer);
+            strcpy(oList[i].affection_list[j].u.name, buffer);
+                 
+            bzero(buffer,256);
+	        ReadMessage(sockfd,buffer);
+	        printf("Relation: %s\n", buffer);
+            strcpy(oList[i].affection_list[j].relation, buffer);
+        }
+    }
+
+    
+    printf("xml transmission done\n");
+
+
+  return 0;
 }
Index: vtcross/branches/trnewman/CR_shell/src/main_cognitive_radio.cpp
===================================================================
--- vtcross/branches/trnewman/CR_shell/src/main_cognitive_radio.cpp	(revision 70)
+++ vtcross/branches/trnewman/CR_shell/src/main_cognitive_radio.cpp	(revision 71)
@@ -224,9 +224,9 @@
     
 	// Wait for incoming message
-	n = recv(socketfd,buffer,255,0);
+	n = read(socketfd,buffer,256);
 	
 	// Print message
     if (n > 0) 
-        printf("Here is the message: %s\n",buffer);
+        printf("Here is the received meessage: %s\n",buffer);
     //printf("n = %d\n",n);
 	
@@ -236,4 +236,8 @@
 int SendMessage(int socketfd, string message) {
 	int n;
+    int len;
+    
+    char LEN[8];
+    char * temp;
 
 	message.append("\0000");	
@@ -251,8 +255,7 @@
 	char counter[55];
 	char var[50];
-
     
 //    while(1) {
-		// Send parameters from struct
+		// Send number of utilities
 		sprintf(counter,"%d",ce_info->numUtilities);
 		SendMessage(socketfd,counter);
@@ -268,5 +271,5 @@
 		}
 
-		/*// parameters
+		// parameters
         sprintf(counter,"%i",ce_info->numParameters);
 		SendMessage(socketfd,counter);
@@ -301,11 +304,10 @@
 				SendMessage(socketfd,oList[i]->affection_list[j].relation);
 			}
-		}*/
-	
-
+		}
+	
 		// Receive a message
         string message;
 		n = ReceiveMessage(socketfd, message);
-        //cout << message << endl;
+        cout << message << endl;
 
 
@@ -394,5 +396,5 @@
 	if(pid == 0) {
 		// In child process - open policy engine port.
-	//	StartShell(30003,uList, pList, oList, &ce_info);
+	//	StartShell(30000,uList, pList, oList, &ce_info);
 	} else {
 		// In parent process - open cognitive engine port.
@@ -402,3 +404,3 @@
 
    return 1;
-} 
+}
