Index: LLRPClient.xslt
===================================================================
RCS file: /cvsroot/llrp-toolkit/LTK/LTKNet/LLRP/LLRPClient.xslt,v
retrieving revision 1.2
diff -u -r1.2 LLRPClient.xslt
--- LLRPClient.xslt	13 Nov 2007 17:59:19 -0000	1.2
+++ LLRPClient.xslt	3 Dec 2007 19:11:16 -0000
@@ -144,27 +144,27 @@
     public bool Open(string llrp_reader_name, int timeout, out ENUM_ConnectionAttemptStatusType status)
     {
     status = ENUM_ConnectionAttemptStatusType.Success;
-    
+
+    conn_evt = new ManualResetEvent(false);
     cI.OnMessageReceived += new delegateMessageReceived(ProcesssMessage);
 
     try{ cI.Open(llrp_reader_name, LLRP1_TCP_PORT);}
-    catch{return false;}
-
+    catch{this.Close(); return false;}
 
-    conn_evt = new ManualResetEvent(false);
     if (conn_evt.WaitOne(timeout, false))
     {
     status = conn_status_type;
     if(status== ENUM_ConnectionAttemptStatusType.Success)return true;
     }
 
-    try { cI.Close(); }
+    try { this.Close(); }
     catch { }
     return false;
     }
 
     public void Close()
     {
+    cI.OnMessageReceived -= ProcesssMessage;
     cI.Close();
     }
 
@@ -210,12 +210,9 @@
           conn_status_type = ntf.__ReaderEventNotificationData.__ConnectionAttemptEvent.__Status;
           conn_evt.Set();
           }
-          else
-          {
           delegateReaderEventNotification rEvent = new delegateReaderEventNotification(TriggerReaderEventNotification);
           rEvent.BeginInvoke(ntf, null, null);
           }
-          }
           catch
           {
           }
