         data.append(UnsafeBufferPointer(start: &tranId, count: 1))
         
         self.socketCommand?.write(data, withTimeout:100, tag:0)
-        self.socketCommand?.readData(withTimeout:1000, tag:0)
+        readCommand()
+    }
+    
+    func readCommand()
+    {
+        self.socketCommand?.readData(withTimeout:10, tag:0)
     }
 }
 
 class SocketCommandDelegate:NSObject, GCDAsyncSocketDelegate
 {
     var step:Int = 0
+    var data:Data?
     weak var connected:MConnectConnected?
     
     func socketDidCloseReadStream(_ sock: GCDAsyncSocket) {

    }
    
    func socket(_ sock: GCDAsyncSocket, didRead data: Data, withTag tag: Int) {
        print("command did read")
        
        if step == 0
        {

    
    func commandAck()
    {
        readCommand()
    }
    
    func commandAckRead()
