<?php//设置运行时间:永不超时set_time_limit (0);//开启缓冲ob_implicit_flush ();//IP地址$ip = "127.0.0.1";//监听端口$port = 80; //创建socket$socket = socket_create (AF_INET, SOCK_STREAM, 0); if (!$socket){ die("创建socket失败!").socket_strerror(socket_last_error());}//绑定socket$bind = socket_bind ($socket, $ip, $port); if (!$bind){ die("绑定.socket失败!").socket_strerror ($bind); }//监听socket$listen = socket_listen ($socket); if (!$listen){ die("监听失败!").socket_strerror ($listen);} echo "{$port}端口监听成功!";?>