I am new to java program and debugging an existing code. This code is to FTP a file to the mainframe system. This code works perfectly if the running environment is windows but it fails in Unix (It is prompting for the password). I am here by pasting a part of the code. If anyone has input please help me.
This is the serious action taking place in the windows platform
Inside DoCommand user m10035 Inside getreply 220-TCPFTP1 IBM FTP CS V1R2 at MVSAA00, 11:10:07 on 2002-04-14. Inside getreply 220 Connection will close if idle for more than 5 minutes. Inside DoCommand pass er2$dr01 Inside getreply 331 Send password please. Inside DoCommand site blocksize=9320 lrecl=932 recfm=vb
This is the serious action taking place in the unix platform. I am getting a null value instead of (331 Send password Please).
Inside DoCommand user m10035 Inside getreply 220-TCPFTP1 IBM FTP CS V1R2 at MVSAA00, 11:22:25 on 2002-04-14. Inside getreply 220 Connection will close if idle for more than 5 minutes. Inside DoCommand pass er2$dr01 Inside getreply null 4/14/2002 11:28:59 AM- FtpPut.java :: LoginToRemoteServer() : java.lang.NullPointerException rc2 false
public static int getreply(DataInputStream is) throws Exception { String sockoutput;
public static int ConnectTo(String IPAddress, String PortAddress) throws Exception { PortAddr = Integer.parseInt(PortAddress); IPAddr = IPAddress; if (IPAddress == "") { log("Usage: java Ftp host"); System.exit(1); }
echoSocket = new Socket( IPAddress, PortAddr); os = new PrintStream(echoSocket.getOutputStream()); is = new DataInputStream(echoSocket.getInputStream()); return 1; }
public static int DoCommand(String userInput, String ldir) throws Exception { System.out.println("Inside DoCommand " + userInput + " " + ldir); if (echoSocket != null && os != null && is != null) { if (userInput.startsWith("list") || userInput.startsWith("nlst")) { getreply(is); doDataPort(userInput, false, is, os); } else if (userInput.startsWith("retr") || userInput.startsWith("get")) { getreply(is); doDataPort(userInput, true, is, os); } else if (userInput.startsWith("rest")) rest(userInput, is, os); else if (userInput.startsWith("stor")) { pause(2000); if (!upload(userInput, ldir, is, os)) { return 0; } } else { os.println(userInput); int temp1 = getreply(is); return temp1; } // end else } // if echosocket return 1; }
Dear van, I am currently doing a project in which I have to transfer files from one computer to another using FTP/Secure FTP.Both the systems run Win2k/nT. I have absolutely no idea how to do this from a Java application.Can you help me out,if possible? Thanx , Pras.