This is my first Socket Script, so please be nice...
Requested script snippet by Truk, very interesting question
The following script is used on the RCD Radio RoBo Bot, but has been edited down for a user version to be shared around and used.