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
Java Code:
socket = new Socket( server, port );
inputStream = new BufferedReader(new InputStreamReader( socket.getInputStream() ) );
outputStream = new PrintStream( socket.getOutputStream() );
My method for sending the NOOP command
Java Code:
outputStream.print( str );
My method for receiving the reply to the NOOP command (which throws the IOException)
Java Code:
inputStream.readLine();
And parts of the code for the data stream, which is located in a different thread
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 ) );
}
Any help would be greatly appreciated.