Ben sadece. I http://127.0.0.1/ üzerinden bağlayabilirsiniz ancak bağlantı noktası 80 üzerinde kendisine gönderilen herhangi bir istek için bir mesaj döner bir minyatür 'web sunucusu' oluşturduk benim gerçek IP ile bağlanmak çalıştığınızda adres, hiçbir şey ile geliyor.
Code:
# config
$conn_ip = "127.0.0.1"; // probably localhost
$conn_port = 80; // port to host 'server' on
$conn_max = 5; // max connections to accept
# end config
$output = 'blah';
# prepare php script
set_time_limit(0);
ob_implicit_flush(true);
# end
# setup the socket
$server = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
socket_bind($server,$conn_ip,$conn_port);
socket_listen($server,$conn_max);
# end
print "listening on port 80...\n\n";
# loop
while (true) {
if (($new_sock = socket_accept($server)) !== NULL) {
print("got connection...\n");
socket_write($new_sock,$output,strlen($output));
socket_close($new_sock);
}
}
# end
?>
Ben burada yanlış ne yapıyorum?