我试图在EC2频道使用袜子 但当我试图运行代码时,我犯了以下错误:
PHP Warning: socket_bind(): unable to bind address [99]: Cannot assign requested address in sockets_test.php on line 45
以下是相关守则的一部分:
$CFG = new stdClass();
$CFG->chat_serverip = MY_PUBLIC_EC2_IP ;
$CFG->chat_serverport = 9111 ;
$listen_socket = socket_create(AF_INET, SOCK_STREAM, 0))
socket_bind($listen_socket, $CFG->chat_serverip, $CFG->chat_serverport)
This works just fine if I use 127.0.0.1 or the Private IP. My Security Group has the the rules:
0-65535 0.0.0.0/0 (TCP)
0-65535 0.0.0.0/0 (UDP)
ALL 0.0.0.0/0 (ICMP)