RussellReal Posted January 16, 2010 Share Posted January 16, 2010 ok I have this code.. its just experimental right now.. but its having problems <?php date_default_timezone_set('America/New_York'); error_reporting(E_ALL); set_time_limit(0); echo "lol\n"; $connection = socket_create_listen(4005); socket_set_nonblock($connection); $clients = array(); while (1) { echo socket_strerror(socket_last_error($connection))."\n"; while ($new = @socket_accept($connection)) { echo "\nFound new!\n"; $clients[] = $new; } foreach ($clients as $v) { while ($line = socket_read($v,1024,PHP_NORMAL_READ)) { foreach ($clients as $v2) { socket_send($v2,$line,strlen($line),MSG_OOB); } } } usleep(500); } ?> the code all works, I've got the following ports forwarded to my computer on the network: 4001 - 4030 and 4005 falls between there so thats the port I'm using to accept connections.. however when I try to CONNECT to this.. I get "target machine actively refused connection": <?php date_default_timezone_set('America/New_York'); $socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP); socket_connect($socket,'192.168.1.103',4005); echo $socket."\n"; sleep(300); ?> so.. I have no idea whats wrong with it, ports are forwarded, I have no firewall.. I can HOST game servers, web servers, why not a PHP based server? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.