Close a socket connection with PHP
===

I have a script that opens a port and allows socket communication between multiple connections (a simple flash chat-box). This script has had to take care of itself regarding how long to run for and when to close the port. My question is, in case this script gets caught in an infinite loop (or I otherwise lose control of it) what can I do to close the port?

To be clear on this, I am after a second php script that will force close the port the first script has opened (I can then put some check code into this script to stop executing if the socket has been closed).