2年前,它的工作,現在發射了一些annyoing錯誤,我無法找到它的答案爲什麼doesnst工作:PHP IRC BOT不會連接
$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,
(有更多的陣列中它是閉合correcty) 和錯誤我得到:
警告:socket_connect()並[f unction.socket-連接]:無法連接[110]:連接在/home/patrick/domains/xxxx/public_html/muts/bot.php超時上線225 插座誤差3:連接超時
有人可以幫我解決這個問題嗎?
也值得注意: - 用相同的連接設置工作通過telnet - 具有相同的連接設置工作與mIRC的 - 它運行的網絡服務器(外部沒有本地計算機)
結果主機: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字節的數據包爲
連接超時=無法到達服務器,或者它不理你。例如你已經被防火牆擋住了。 –
您是否對本地IRC服務器進行過測試,以確保它實際上是您的代碼,而不是您程序的外部? –
服務器處於活動狀態,端口工作原因當我連接與mirc使用相同的設置它的作用,telnet相同,以便不存在問題 –