You can only do one request at a time with this script. You do not need to close the socket normally, it should happen automatically once the entire page is transmitted.

Add this as second line so that you can see (echo -> only you see it) when a request is done when a previous was still underway. The floodprotection is needed because of the amount of data, you can normally send about once message each second (or 2) without being flooded off, if you type more/faster, the server might kick you for flooding. This can happen because of one long page, or many shorter pages, or a short page + very active chatting, or ...

if ($sock(bot)) { echo $target Request denied, previous entry not finished yet. | return }