I've done a lot of searching through files and I think I may have tracked down where it's coming from. This may be a little hard to follow but I will try to explain it well.
The file that gets called is /modules/stock-update.php. This file (along with every other callable file in the system) includes /resources/system.php. This is done using the normal include() function.
system.php includes a number of other files. 2 of these other files are /resources/functions/console.php and /resources/functions.php.
stock-update.php also includes /modules/stock-update.class.php using includeFile() which is a wrapper for include() and is defined in functions.php.
In stock-update.class.php on line 705 there is the following line.
addConsoleMessage('stockupdate','I8003',$server['serverID']);
The addConsoleMessage() function is defined in console.php and calls consoleConnect() in the same file which then calls socket_create(), socket_set_nonblock(), gethostbyname(), socket_connect() and stocket_last_error(). All of these are above line 45 in the file.
This is the only place any of these functions are used in the entire system. All local files are included using include() or includeFile() and all remote requests (except console messages) use cURL. It does seem a little complicated but I can't see anything else it could be. It seems as though PHPs error system is getting confused somewhere due to the includes.
The console host is a fixed constant and it is listed in /etc/hosts so it shouldn't be a lookup error. The host is on the same network but it is a Windows server which does have a habit of restarting for Windows update around the time of the last set of errors.
Thanks for your help. Unless you think I've got it wrong I'm just going to ignore these errors as the console connection is only for debugging.