Index: /trunk/BNS/bns.cpp
===================================================================
--- /trunk/BNS/bns.cpp	(revision 759)
+++ /trunk/BNS/bns.cpp	(revision 760)
@@ -24,7 +24,12 @@
 ////////////////////////////////////////////////////////////////////////////
 t_bns::t_bns(QObject* parent) : QThread(parent) {
+
   _bnseph = new t_bnseph(parent);
+
   connect(_bnseph, SIGNAL(newMessage(QByteArray)),
           this, SLOT(slotMessage(const QByteArray)));
+
+  connect(_bnseph, SIGNAL(error(QByteArray)),
+          this, SLOT(slotError(const QByteArray)));
 }
 
@@ -42,4 +47,11 @@
 }
 
+// Write a Program Message
+////////////////////////////////////////////////////////////////////////////
+void t_bns::slotError(const QByteArray msg) {
+  cerr << msg.data() << endl;
+  emit(error(msg));
+}
+
 // Start 
 ////////////////////////////////////////////////////////////////////////////
Index: /trunk/BNS/bns.h
===================================================================
--- /trunk/BNS/bns.h	(revision 759)
+++ /trunk/BNS/bns.h	(revision 760)
@@ -16,7 +16,9 @@
  signals:
   void newMessage(const QByteArray msg);
+  void error(const QByteArray msg);
  
  private slots:
   void slotMessage(const QByteArray msg);
+  void slotError(const QByteArray msg);
 
  private:
Index: /trunk/BNS/bnseph.cpp
===================================================================
--- /trunk/BNS/bnseph.cpp	(revision 759)
+++ /trunk/BNS/bnseph.cpp	(revision 760)
@@ -46,18 +46,17 @@
   _socket->connectToHost(host, port);
 
-  const int timeOut = 10*1000;  // 10 seconds
+  const int timeOut = 3*1000;  // 3 seconds
   if (!_socket->waitForConnected(timeOut)) {
-    emit(newMessage("bnseph::run Connect Timeout"));
-    delete _socket; _socket = 0;
-    return;
+    emit(error("bnseph::run Connect Timeout"));
   }
-
-  while (true) {
-    if (_socket->canReadLine()) {
-      QByteArray line = _socket->readLine();
-      emit(newMessage(line));
-    }
-    else {
-      _socket->waitForReadyRead(10);
+  else {
+    while (true) {
+      if (_socket->canReadLine()) {
+        QByteArray line = _socket->readLine();
+        emit(newMessage(line));
+      }
+      else {
+        _socket->waitForReadyRead(10);
+      }
     }
   }
Index: /trunk/BNS/bnseph.h
===================================================================
--- /trunk/BNS/bnseph.h	(revision 759)
+++ /trunk/BNS/bnseph.h	(revision 760)
@@ -14,4 +14,5 @@
  signals:
   void newMessage(const QByteArray msg);
+  void error(const QByteArray msg);
  
  private:
Index: /trunk/BNS/bnswindow.cpp
===================================================================
--- /trunk/BNS/bnswindow.cpp	(revision 759)
+++ /trunk/BNS/bnswindow.cpp	(revision 760)
@@ -280,4 +280,20 @@
 }  
 
+// Delete bns
+////////////////////////////////////////////////////////////////////////////
+void bnsWindow::deleteBns() {
+  _actStart->setEnabled(true);
+  _actStop->setEnabled(false);
+  delete _bns; 
+  _bns = 0;
+}  
+
+// Error in bns
+////////////////////////////////////////////////////////////////////////////
+void bnsWindow::slotError(const QByteArray msg) {
+  slotMessage(msg);
+  deleteBns();
+}  
+
 // Stop 
 ////////////////////////////////////////////////////////////////////////////
@@ -287,8 +303,5 @@
                                    QMessageBox::NoButton);
   if (iRet == QMessageBox::Yes) {
-    _actStart->setEnabled(true);
-    _actStop->setEnabled(false);
-    delete _bns; 
-    _bns = 0;
+    deleteBns();
   }
 }
@@ -303,6 +316,11 @@
 
   _bns = new t_bns(0);
+
   connect(_bns, SIGNAL(newMessage(QByteArray)),
           this, SLOT(slotMessage(const QByteArray)));
+
+  connect(_bns, SIGNAL(error(QByteArray)),
+          this, SLOT(slotError(const QByteArray)));
+
   _bns->start();
 }
Index: /trunk/BNS/bnswindow.h
===================================================================
--- /trunk/BNS/bnswindow.h	(revision 759)
+++ /trunk/BNS/bnswindow.h	(revision 760)
@@ -23,4 +23,5 @@
  public slots:  
   void slotMessage(const QByteArray msg);
+  void slotError(const QByteArray msg);
 
  private slots:
@@ -39,4 +40,5 @@
   void CreateMenu();
   void AddToolbar();
+  void deleteBns();
 
   QMenu*     _menuHlp;
