java - FTP proxy design: how to shutdown data channel properly at client side -


i'm using java writing simple ftp proxy. created data connection after acceptance of port (200 server) or pasv(227 ip+port server).

i found proxy have "manually" notify terminate data channel of other side (side b, either client or server) termination of data channel of 1 side (side a, either server or client, when read length of -1 reached); side b cannot terminate data channel (by writing length -1 inputstream) control level. did this.

found issue bellow. firstly normal (per understanding) list of application level communication sequence:

1. client send list;

2. server send "150 opening binary mode data connection '/bin/ls'.";

3. server fire data;

4. server send "226 transfer complete.";

5. server shutdown local data connection , proxy notify client shutdown data connection.

while works fine in cases, failed in case. in case, data comes client prior response code 150. client cannot handle correctly. , when proxy notifies client shut down data channel, client sends "quit" , exited session.

the question is: mechanism ftp terminate data channel (how client handles in case of no proxy between), , correct solution terminate/handle data channel proxy? thanks.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -