Index: fact/FADctrl/FAD.cc
===================================================================
--- fact/FADctrl/FAD.cc	(revision 10261)
+++ fact/FADctrl/FAD.cc	(revision 10262)
@@ -612,5 +612,5 @@
 	if (i<R.Min || i > R.Max) continue;
 
-	PrintMessage("BOARD #%d (%sactive)   IP %s   Communication %s\n", i, Boards[i]->Active ? "":"in", Boards[i]->Name, Boards[i]->CommOK ? "OK":"ERROR");
+	PrintMessage("\nBOARD #%d (%sactive)   IP %s   Communication %s\n", i, Boards[i]->Active ? "":"in", Boards[i]->Name, Boards[i]->CommOK ? "OK":"ERROR");
 
 	// Calibration information
@@ -620,4 +620,6 @@
 	// Status information
 	struct FADBoard::BoardStatus S = Boards[i]->GetStatus();
+
+	PrintMessage("Status: %s\n", S.Message);
 
 	if (S.Update.tv_sec == -1) {
@@ -1018,10 +1020,15 @@
 	if (Mode != datarun) continue;
 	
-	// Check if all event numbers of active boards are the same
-	bool Same = true;
-	for (unsigned int i=0; i<Boards.size(); i++) {
-	  if (Boards[i]->Active && EventNumbers[i] != EventNumbers[0]) Same = false;
-	}
-	if (!Same) continue;
+	// Check if event numbers of all active boards are the same
+	unsigned long CommonEventNum = numeric_limits<unsigned long>::max();
+	
+	for (unsigned int i=0; i<Boards.size(); i++) if (Boards[i]->Active) {
+	  if (CommonEventNum == numeric_limits<unsigned long>::max()) CommonEventNum = EventNumbers[i];
+	  if (CommonEventNum != EventNumbers[i]) {
+		CommonEventNum = numeric_limits<unsigned long>::max();
+		break;
+	  }
+	}
+	if (CommonEventNum == numeric_limits<unsigned long>::max()) continue;
 
 	// Write also run header if this is the first event
Index: fact/FADctrl/FADBoard.cc
===================================================================
--- fact/FADctrl/FADBoard.cc	(revision 10261)
+++ fact/FADctrl/FADBoard.cc	(revision 10262)
@@ -47,4 +47,5 @@
 
   DIM_Name = new DimService((ID.str()+"Server").c_str(), Name);
+  DIM_Status = new DimService((ID.str()+"Status").c_str(), (char *) "");
   DIM_ID = new DimService((ID.str()+"BoardID").c_str(), (char *) "S", NULL, 0);
   DIM_Temp = new DimService((ID.str()+"Temperature").c_str(), (char *) "F", NULL, 0);
@@ -53,4 +54,6 @@
 
   // Create thread that connects and receives data
+  SetStatus("Trying to connect");
+
   if ((Ret = pthread_create(&Thread, NULL, (void * (*)(void *)) LaunchThread,(void *) this)) != 0) {
     m->Message(m->FATAL, "pthread_create() failed in FADBoard() (%s)", strerror(Ret));
@@ -77,4 +80,5 @@
 
   delete DIM_Name;
+  delete DIM_Status;
   delete DIM_ID;
   delete DIM_Temp;
@@ -349,5 +353,5 @@
   struct hostent *Host = gethostbyname(Name);
   if (Host == 0) {
-    m->Message(m->WARN, "Could not resolve host name for %s", Name);
+    SetStatus("Could not resolve host name '%s'", Name);
     return;
   }
@@ -365,9 +369,10 @@
   // Connect to server
   if (connect(Socket, (struct sockaddr *) &SocketAddress, sizeof(SocketAddress)) == -1) {
-    m->PrintMessage("Could not connect to %s at port %d (%s)\n", Name, Port, strerror(errno));
+    SetStatus("Could not connect to port %hu (%s)", Port, strerror(errno));
   }
   else {
 	CommOK = true;
 	Active = true;
+    SetStatus("Connected");
   }
 
@@ -381,10 +386,10 @@
 	// Check result of read
 	if (Result == -1) {
-	  m->PrintMessage("Error: Could not read from socket, exiting read loop (%s)\n", strerror(errno));
+	  m->Message(m->ERROR, "Could not read from socket for %s, exiting read loop (%s)\n", Name, strerror(errno));
 	  CommOK = false;
 	  break;
 	}
 	else if (Result == 0) {
-	  m->PrintMessage("Server not existing anymore, exiting read loop\n");
+	  SetStatus("Server not existing anymore, exiting read loop");
 	  CommOK = false;
 	  break;
@@ -399,5 +404,5 @@
 	// Check if internal buffer full
 	if (Pos == sizeof(Buffer)) {
-	  m->PrintMessage("Internal buffer full, deleting all data in buffer\n");
+	  SetStatus("Internal buffer full, deleting all data in buffer");
 	  Pos = 0;
 	  continue;
@@ -410,5 +415,5 @@
 	  memmove(Buffer, Buffer+Temp, Pos-Temp);
 	  Pos -= Temp;
-	  m->PrintMessage("Removed %d bytes because of start_package_flag not found for %s\n", Temp, Name);
+	  SetStatus("Removed %d bytes because of start_package_flag not found", Temp);
 	  continue;
 	}
@@ -521,5 +526,5 @@
 	  }	    
 	}
-	else m->PrintMessage("End package flag incorrect, removing corrupt event\n");
+	else SetStatus("End package flag incorrect, removing corrupt event");
 
 	// Remove event data from internal buffer
@@ -532,9 +537,8 @@
 
   if (close(Socket) == -1) {
-	m->PrintMessage("Could not close socket descriptor for board %s (%s)", Name, strerror(errno));  
-  }
-
-}
-
+	m->Message(m->ERROR, "Could not close socket descriptor for board %s (%s)", Name, strerror(errno));  
+  }
+
+}
 
 //
@@ -544,4 +548,26 @@
 
   m->ReadLoop();
+}
+
+
+//
+// Set status message
+//
+void FADBoard::SetStatus(const char *Format, ...) {
+
+  int Ret;
+
+  // Assemble message
+  va_list ArgumentPointer;
+  va_start(ArgumentPointer, Format);
+  Lock();
+  Ret = vsnprintf(Status.Message, sizeof(Status.Message), Format, ArgumentPointer);
+  Unlock();
+  va_end(ArgumentPointer);
+
+  if (Ret == -1) m->Message(m->FATAL, "snprintf() in FADBoard::SetStatus() failed (%s)", strerror(errno));
+
+  // Update status service
+  DIM_Status->updateService(Status.Message);
 }
 
@@ -571,4 +597,6 @@
 //
 // Open other sockets
+//
+//  Error reporting is limited as this function is expected to be removed when firmware allows single socket
 //
 void FADBoard::threadHandler() {
@@ -581,8 +609,5 @@
   // Resolve hostname
   struct hostent *Host = gethostbyname(Name);
-  if (Host == 0) {
-    m->PrintMessage("OtherSockets: Could not resolve host name for %s\n", Name);
-    return;
-  }
+  if (Host == 0) return;
 
   // Connect to server
@@ -594,5 +619,5 @@
 	// Open socket descriptor
 	if ((Socket[i] = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
-      m->PrintMessage("OtherSockets: Could not open socket for port %d (%s)\n", List[i], strerror(errno));
+      m->Message(m->ERROR, "OtherSockets: Could not open socket for port %d (%s)\n", List[i], strerror(errno));
       return;
 	}
@@ -601,8 +626,5 @@
 	// Connect to server
     SocketAddress.sin_port = htons((unsigned short) List[i]);
-	if (connect(Socket[i], (struct sockaddr *) &SocketAddress, sizeof(SocketAddress)) == -1) {
-      m->PrintMessage("OtherSockets: Could not connect to port %d (%s)\n", List[i], strerror(errno));
-      return;
-	}
+	if (connect(Socket[i], (struct sockaddr *) &SocketAddress, sizeof(SocketAddress)) == -1) return;
   }
   
@@ -612,5 +634,5 @@
     for (unsigned int i=0; i<sizeof(List)/sizeof(int); i++) FD_SET(Socket[i], &DescriptorList);
     if (select(MaxSocketNum+1, &DescriptorList, NULL, NULL, NULL) == -1) {
-      m->PrintMessage("OtherSockets: Error with select() (%s)\n", strerror(errno));
+      m->Message(m->ERROR, "OtherSockets: Error with select() (%s)\n", strerror(errno));
       break;
     }
@@ -619,6 +641,5 @@
 	for (unsigned int i=0; i<sizeof(List)/sizeof(int); i++) if (FD_ISSET(Socket[i], &DescriptorList)) {
 	  Ret = read(Socket[i], Buffer, sizeof(Buffer));
-      if(Ret == 0) m->PrintMessage("OtherSockets: Connection to port %d not existing anymore\n", List[i]);
-      else if (Ret == -1) m->PrintMessage("OtherSockets: Error reading from port %d (%s)\n", List[i], strerror(errno));
+      if (Ret == -1) m->Message(m->ERROR, "OtherSockets: Error reading from port %d (%s)\n", List[i], strerror(errno));
     }
   }
@@ -627,6 +648,6 @@
   for (unsigned int i=0; i<sizeof(List)/sizeof(int); i++) {
 	if ((Socket[i] != -1) && (close(Socket[i]) == -1)) {
-	  m->PrintMessage("OtherSockets: Could not close socket of port %d (%s)", List[i], strerror(errno));  
-	}
-  }
-}
+	  m->Message(m->ERROR, "OtherSockets: Could not close socket of port %d (%s)", List[i], strerror(errno));  
+	}
+  }
+}
Index: fact/FADctrl/FADBoard.h
===================================================================
--- fact/FADctrl/FADBoard.h	(revision 10261)
+++ fact/FADctrl/FADBoard.h	(revision 10262)
@@ -21,4 +21,5 @@
 
 const unsigned int READ_BUFFER_SIZE = 1000000;
+const unsigned int STATUS_SIZE = 200;
 
 class FADBoard: public DimThread {
@@ -27,9 +28,10 @@
 	int Socket;
 	pthread_mutex_t Mutex;
-	DimService *DIM_Name, *DIM_ID, *DIM_Temp, *DIM_ROI, *DIM_DAC;
+	DimService *DIM_Name, *DIM_Status, *DIM_ID, *DIM_Temp, *DIM_ROI, *DIM_DAC;
 
 	void ReadLoop();
 	static void LaunchThread(class FADBoard *);
 	void threadHandler();
+	void SetStatus(const char *, ...);
 
   public: 
@@ -43,4 +45,6 @@
 	  uint32_t BoardTime;
 	  uint32_t EventCounter;
+
+	  char Message[STATUS_SIZE];
 	  struct timeval Update;
 
@@ -93,5 +97,5 @@
 	pthread_cond_t CondVar;
 	
-  // Amplitude calibration
+    // Amplitude calibration
    	int Count;  
 
Index: fact/FADctrl/History.txt
===================================================================
--- fact/FADctrl/History.txt	(revision 10261)
+++ fact/FADctrl/History.txt	(revision 10262)
@@ -18,2 +18,3 @@
 2/3/2011	Implemented new FAD data format
 28/3/2011	Boards with communication error set themselves inactive
+29/3/2011	Added Status message service for each board (removed several console messages in turn)
