     "NLST": (reqPath = "")->
       @fileSystem.getNlst @sessionDir, reqPath, (err, files)=>
         if err?
+          if @passive
+            @dtpServer.close()
           @reply 550, "#{reqPath}: No such file or directory"
         else
-          @dtpServer.dataQueue = files.join("\r\n") + "\r\n"
-          @reply 150
+          @dtpServer.dtpSocket.sender files.join("\r\n") + "\r\n"
     
     "LIST": (reqPath = "")->
       @fileSystem.getList @sessionDir, reqPath, (err, stdout, stderr)=>
         if err?
+          if @passive
+            @dtpServer.close()
           @reply 550, "#{reqPath}: No such file or directory"
         else
-          @dtpServer.dataQueue = stdout.replace(/^total [0-9]+$/im, "").trim()
-          @reply 150
-    
-    "RETR": ()->
-      @dtpServer.dataQueue = "<html></html>"
-      @reply 150
+          @dtpServer.dtpSocket.sender stdout.replace(/^total [0-9]+$/im, "").trim()
+    
+    "RETR": (reqPath)->
+      @fileSystem.getFile @sessionDir, reqPath, (err, data)=>
+        if err?
+          if @passive
+            @dtpServer.close()
+          @reply 550, "#{reqPath}: No such file or directory"
+        else
+          @dtpServer.dtpSocket.sender data
     
     "SYST": ()->
       @reply 215, BabyFtpd.sysName

#
# # Baby FTP Deamon
#
net       = require "net"
fs        = require "fs"
exec      = require("child_process").exec

module.exports = class BabyFtpd
  # Static variables

            tmpDir.pop()
          tmpDir.push aPath
      retPath = tmpDir.join("/")
    fs.statSync @baseDir+retPath
    retPath
  
  getNlst: (nowDir, reqPath, callback)->
    try
      retPath = @getNewPath nowDir, reqPath
      fs.readdir @baseDir+retPath, callback
    catch err
      callback(err)
  
  getList: (nowDir, reqPath, callback)->
    try
      retPath = @getNewPath nowDir, reqPath
      exec "export LANG=en_US.UTF-8; ls -l #{@baseDir}#{retPath}", callback
    catch err
      callback(err)
  
  getFile: (nowDir, reqPath, callback)->
    try
      retPath = @getNewPath nowDir, reqPath
      fs.readFile @baseDir+retPath, callback
    catch err
      callback(err)
