FTP programming: how to interrupt file transfer?

I am making a small ftp client to get some large files from ftp. I read in the RFC that the ABOR command is very problematic for servers. Almost all the servers that I see continue to send data even after ABOR is sent through a control connection. Closing the data transfer may lead (in 70% of the tests) to closing the control connection. The server simply sends the FIN packet after I clicked on the ABOR packet. What is the best good way to stop receiving on some byte and not lose control connection? FlashFXP does this fine for all types of delays and servers. When examining tcp traffic, I found a standard ftp rfc stream.

But in my case, it still fails to interrupt the transmission using this technique:

1) shutdown (passive_socket, SD_BOTH)

2) closesocket (passive_socket);

3) send (control_socket, "ABOR \ r \ n")

4) recv (control_socket) - stopped here

thank

+5
source share
2 answers

The command "ABOR \ r \ n" should be sent as out-of-band data. In case of sending () -

send(control_socket, "ABOR\r\n", 6, MSG_OOB);

Some time after the return code, recv () 426 Transfer is canceled. Data connection closed.

The following link is more useful if you cannot succeed in passing aborint: http://www.developer.nokia.com/Community/Discussion/showthread.php?134079-Telnet-quot-Interrupt-Process-quot-(IP)- signal-amp-telnet-quot-synch-quot

+6
source

, . , , , .

0

All Articles