Results 1 to 1 of 1
- 03-23-2009, 09:03 AM #1
Member
- Join Date
- Mar 2009
- Posts
- 1
- Rep Power
- 0
Connection reset error in FTP client
Hello,
I've been programming a FTP client in java. It’s being compiled as an application with JDK version 1.6.0_12. It automatically sends a NOOP command if 30 seconds have passed without a message being sent over the control stream. If I upload a large file, one that takes more than 30 seconds to transfer, the control stream will remain idle for those 30 seconds and a NOOP will be due. However, when my application sends this command some kind of error occurs - or more specifically when I attempt to receive the response to the NOOP command a “java.net.SocketException: Connection reset” error is thrown. As I said this error only occurs when I attempt to send a message on the control stream simultaneously with doing something on the data stream.
I’m not quite sure what code might be relevant, but here goes:
The socket/etc for the control stream
My method for sending the NOOP commandJava Code:socket = new Socket( server, port ); inputStream = new BufferedReader(new InputStreamReader( socket.getInputStream() ) ); outputStream = new PrintStream( socket.getOutputStream() );
My method for receiving the reply to the NOOP command (which throws the IOException)Java Code:outputStream.print( str );
And parts of the code for the data stream, which is located in a different threadJava Code:inputStream.readLine();
Any help would be greatly appreciated.Java Code:Socket workerSocket = new Socket( workerIP, workerPort ); PrintStream workerStream = new PrintStream( workerSocket.getOutputStream() ); // reader reads from the local file that is getting uploaded BufferedReader reader = new BufferedReader(new InputStreamReader( localURL.openStream() )); char []in = new char[100]; int charsRead; while( (charsRead = reader.read( in, 0, 100) ) >= 0 ) { workerStream.print( String.copyValueOf( in, 0, charsRead ) ); }
Similar Threads
-
Software caused connection abort: socket write error
By kuguy in forum NetworkingReplies: 3Last Post: 04-13-2010, 03:43 PM -
Ping Client error - help. =]
By ICER in forum NetworkingReplies: 3Last Post: 02-18-2009, 02:57 PM -
RAD - Error getting connection: Timeout.
By ShoeNinja in forum Other IDEsReplies: 0Last Post: 09-09-2008, 05:25 PM -
How to implement secure connection(HTTPs) in client side
By vicky in forum NetworkingReplies: 6Last Post: 07-18-2007, 03:15 PM -
error I/O connection
By bbq in forum JDBCReplies: 1Last Post: 07-05-2007, 01:33 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks