Limiting Parallel/Simultaneous Downloads - How to know if download was cancelled?

后端 未结 3 953
一整个雨季
一整个雨季 2021-01-01 08:50

I have a simple file upload service, written out in PHP, which also includes a script that controls download speeds by sending limited-sized packets when a user requests a d

3条回答
  •  情话喂你
    2021-01-01 08:57

    There is no HTTP "cancel" signal that is sent by default. So, it looks like you will need to decide on a timeout, the length of time a connection can sit without sending/receiving another packet. If you are sending rather small packets (as I presume you are) keep the timeout short for best effect.

    In your while condition you will need to check the age of the last timestamp update, if its too old, stop sending the file.

提交回复
热议问题