Best approach to cancel TCP forwarding?


I'm dumping data from my server app to my client app in chunks (TCP/IP). At some point the client may wish to abort the transfer and make a new request to the server. The rapid approach to get this done is to kill the TCP connection so that any data already sent by the server and live on the network is dumped. The new connection will handle the new request/transfer so there is no delay in receiving old redundant data.

Is this an acceptable solution?

NB: I did consider breaking the chunks into smaller sizes separated by client ack messages but then you have the problem of fixing a chunk size....too small and too many acks (slowed transfer)....too big and there is still a residual delay in dumping redundant data.

Any ideas or standard design approaches that I should be aware of? TIA

You can use two TCP connection similar to FTP - one to send control request to the server & other transfers the actual data. If you wish to abort a transfer then just a request to abort it over control channel.