I'm trying to create a very basic Java FTP server.
The code to handle the incoming socket, accept it, and turn it into a client thread seems to work great, but for some reason it doesn't look like data is getting TO the client when I try to send the welcome message.
// outputstreamwriter for socket
out = new OutputStreamWriter(socket.getOutputStream(),"UTF-8");
// function for sending data
private void send(String s) {
try {
out.write(s,0,s.length());
out.flush();
} catch (IOException e) {
System.out.println("Exception during send(): " + e);
}
System.out.println("> " + s);
}
I see in my console that it is running and trying to send the welcome message, however FileZilla (the FTP client I'm using to connect) usually sits at:
"Connection established, waiting for welcome message..."
===
Edit
The welcome message is pretty basic: send("220 WELCOME TO THE FTP SERVER");
I'm trying to include only the relevant code because it's far too much to post here. (Listening server thread which launches each client thread, etc.) The point is that it's getting to this point in the code without any problems (i.e. client thread w/ accepted socket ready-to-go) and then when I send data FileZilla appears not to see it.