      Read data until a specific pattern (including the pattern).
 
      - parameter data: The pattern.
-     - parameter tag:  The tag identifying the data in the callback delegate method.
      - parameter maxLength: The max length of data to scan for the pattern.
      - warning: This should only be called after the last read is finished, i.e., `delegate?.didReadData()` is called.
      */
-    open func readDataToData(_ data: Data, withTag tag: Int, maxLength: Int) {
+    open func readDataTo(data: Data, maxLength: Int) {
         var maxLength = maxLength
         if maxLength == 0 {
             maxLength = Opt.MAXNWTCPScanLength
         }
         scanner = StreamScanner(pattern: data, maximumLength: maxLength)
-        scannerTag = tag
-        readDataWithTag(NWTCPSocket.ScannerReadTag)
+        scanning = true
+        readData()
     }
 
     fileprivate func queueCall(_ block: @escaping ()->()) {

            queueCall {
                let delegate = self.delegate
                self.delegate = nil
                delegate?.didDisconnect(self)
            }
        default:
            break
        }
    }

    fileprivate func readCallback(_ data: Data?, tag: Int) {
        queueCall {
            guard let data = self.consumeReadData(data) else {
                // remote read is closed, but this is okay, nothing need to be done, if this socket is read again, then error occurs.
                return
            }

            if tag == NWTCPSocket.ScannerReadTag {
                guard let (match, rest) = self.scanner.addAndScan(data) else {
                    self.readDataWithTag(NWTCPSocket.ScannerReadTag)
                    return
                }

                self.scanner = nil

                guard let matchData = match else {
                    // do not find match in the given length, stop now

        switch connection!.state {
        case .connected:
            queueCall {
                self.delegate?.didConnectWith(socket: self)
            }
        case .disconnected:
            cancel()
