簡體   English   中英

PHP IRC BOT不會連接

[英]PHP IRC BOT wont connect

2年前它工作,現在解決了一些annyoing錯誤,我找不到答案為什么它沒有工作:

$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:連接超時

有誰可以幫我解決這個問題?

另外值得注意的是: - 使用與telnet相同的連接設置 - 使用與mIRC相同的連接設置 - 運行Web服務器(外部非本地計算機)

主機的結果:OGN2.OnlineGamesNet.net是ogn2.ogamenet.net的別名。 ogn2.ogamenet.net的地址為79.110.87.154 - traceroute:traceroute到79.110.87.154(79.110.87.154),最大30跳,40字節包

除了您的代碼之外,該錯誤指向外部的東西 - 特別是如果它之前有效。

檢查防火牆設置和套接字端口,以及要連接的服務器是否處於活動狀態。

將此代碼添加到PHP文件的頂部以獲取更詳細的錯誤消息:

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

如果您有SSH訪問權限,請嘗試這些:

DNS問題?

host OGN2.OnlineGamesNet.net

路由問題?

traceroute 79.110.87.154

嘗試完整的TCP握手

telnet OGN2.OnlineGamesNet.net 6667

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM