13.05.2012, 06:58
Replace the socket initialization lines with:
This will give you a more precise error description. If you consider the code looking bad, compare the function results to false (a type and value check with === not ==) and call socket_strerror(socket_last_error($socket)).
The most common mistakes I see people making with these is:
1. using localhost instead of numeric host - this does (on most systems at least) not work
2. using a common communication port - something is already using this port
Try to see what the script gives you now, also how are you trying to run it?
If posting PHP and general socket-related talk bothers someone as it really is not about the plugin, please let me know.
PHP код:
$socket = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp')) or die("Error in socket_create: " . socket_strerror(socket_last_error($socket)) . "\n");
socket_bind($socket, "127.0.0.1", 7778) or die("Error in socket_bind: " . socket_strerror(socket_last_error($socket)) . "\n");
socket_listen($socket, 5) or die("Error in socket_listen: " . socket_strerror(socket_last_error($socket)) . "\n");
The most common mistakes I see people making with these is:
1. using localhost instead of numeric host - this does (on most systems at least) not work
2. using a common communication port - something is already using this port
Try to see what the script gives you now, also how are you trying to run it?
If posting PHP and general socket-related talk bothers someone as it really is not about the plugin, please let me know.