PHP IRC BOT 无法连接



2 年前它有效,现在因一些公告错误而启动,我找不到它为什么不起作用的答案:

$this->BotSocket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
    if (!$this->BotSocket) {
        die('Socket error1 : '.socket_strerror(socket_last_error()));
    }
    /**
     * Bind the socket to make it irc'able 
     */
    if(!socket_bind($this->BotSocket, $this->BotConfig['hostname'])) { 
        die('Socket error2 : '.socket_strerror(socket_last_error()));
    }

    if(!socket_connect($this->BotSocket, $this->BotConfig['server'], $this->BotConfig['port'])) { 
        die('Socket error3 : '.socket_strerror(socket_last_error()));
    }

和连接字符串:

        $this->BotConfig = array(
        /**
         * Bot configuration for information
         */
        'nickname' => 'Muts',
        'realname' => 'Vii personal funbot',
        'ident'    => 'Muts',
        /**
         * Bot server configration
         */
        'hostname' => 0,
        'server'   => 'OGN2.OnlineGamesNet.net',
        'port'     => 6667,

(数组中还有更多内容,它已正确关闭)和我得到的错误:

警告:socket_connect() [function.socket-connect]:无法连接 [110]:连接在第 225 行的/home/patrick/domains/xxxx/public_html/muts/bot.php 中超时 套接字错误3:连接超时

有人可以帮助我解决这个问题吗?

还值得注意:- 使用与远程登录相同的连接设置- 使用与 mIRC 相同的连接设置- 它正在运行网络服务器(外部而不是本地计算机)

主机的结果:OGN2。OnlineGamesNet.net 是 ogn2.ogamenet.net 的别名。ogn2.ogamenet.net 的地址为 79.110.87.154 - 跟踪路由:跟踪路由到 79.110.87.154 (79.110.87.154),最多 30 跳,40 字节数据包

该错误指向外部内容,而不是您的代码 - 特别是如果它以前有效。

检查防火墙设置和套接字端口,以及要连接到的服务器是否处于活动状态。

将此代码添加到 PHP 文件的顶部以获取更详细的错误消息:

error_reporting(E_ALL);
ini_set("display_errors", 1);

如果您有 SSH 访问权限,请尝试以下操作:

域名系统问题?

host OGN2.OnlineGamesNet.net

路由问题?

traceroute 79.110.87.154

尝试完整的 TCP 握手

telnet OGN2.OnlineGamesNet.net 6667

最新更新