
// Add this code 
    public int dataSocketOut(String datCmd,Reader r) throws IOException {
	int status;
	status=dataSocket(datCmd);
	if (status!=0) return status;
	datWriter=new OutputStreamWriter(datskt.getOutputStream());
	int ch;
	do {
	    ch=r.read();
	    if (ch!=-1) datWriter.write((char)ch);
	} while (ch!=-1);
	datWriter.flush();
	datskt.close();
	return getResponse();
    }



    public static void main(String [] args) throws Exception {
        if (args.length<3||args.length>4) {
	    System.out.println("usage: EZftp host user password [directory]");
	    System.exit(1);
	}
	FtpLS obj= new FtpLS();
	obj.passive=true;
	if (!obj.connect(args[0],args[1],args[2])) {
	    System.out.println("Can't connect");
	    System.exit(1);
	}

	FileWriter f = new FileWriter("ftp.test");
	obj.dataSocketIn("RETR readme",f);
	System.out.println(obj.lastResponse);

	// Write test
	FileReader fw = new FileReader("ftp.test");
	obj.dataSocketOut("STOR ftp1.test",fw);
	System.out.println(obj.lastResponse);


	System.exit(0);
    }
}
