     
     var inputStream: NSInputStream?
     var outputStream: NSOutputStream?
+    var pingTimer: NSTimer?
     
     var parsingString: NSString = ""
     

        let message = "<thread thread=\"\(server.thread)\" res_from=\"-\(resFrom)\" version=\"20061206\"/>"
        self.sendMessage(message)
        
        while self.inputStream != nil {
            self.runLoop.runUntilDate(NSDate(timeIntervalSinceNow: NSTimeInterval(1)))
        }

    func closeSocket() {
        fileLog.debug("closed streams.")
        
        self.stopPingTimer()

        self.inputStream?.delegate = nil
        self.outputStream?.delegate = nil
        
