PHP IRC BOT无法连接

zbdgwd5y  于 2023-05-16  发布在  PHP
关注(0)|答案(2)|浏览(106)

2年前它工作了,现在发射了一些annyoing错误什么我找不到它的答案为什么它不工作:

  1. $this->BotSocket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
  2. if (!$this->BotSocket) {
  3. die('Socket error1 : '.socket_strerror(socket_last_error()));
  4. }
  5. /**
  6. * Bind the socket to make it irc'able
  7. */
  8. if(!socket_bind($this->BotSocket, $this->BotConfig['hostname'])) {
  9. die('Socket error2 : '.socket_strerror(socket_last_error()));
  10. }
  11. if(!socket_connect($this->BotSocket, $this->BotConfig['server'], $this->BotConfig['port'])) {
  12. die('Socket error3 : '.socket_strerror(socket_last_error()));
  13. }

以及连接字符串:

  1. $this->BotConfig = array(
  2. /**
  3. * Bot configuration for information
  4. */
  5. 'nickname' => 'Muts',
  6. 'realname' => 'Vii personal funbot',
  7. 'ident' => 'Muts',
  8. /**
  9. * Bot server configration
  10. */
  11. 'hostname' => 0,
  12. 'server' => 'OGN2.OnlineGamesNet.net',
  13. 'port' => 6667,

(数组中有更多的是正确关闭的)和我得到的错误:
警告:socket_connect()[function.socket-connect]:无法连接[110]:/home/functions/public_html/functions/functions.php LINE:404错误类型:连接超时
有人能帮我吗
还值得注意的是:- 使用与telnet相同的连接设置-使用与mIRC相同的连接设置-它在Web服务器上运行(外部而不是本地计算机)
主机的结果:OGN2.OnlineGamesNet.net的别名ogn2.ogamenet.net。ogn2.ogamenet.net具有地址79.110.87.154- traceroute:跟踪路由到79.110.87.154(79.110.87.154),最多30跳,40字节数据包

huus2vyu

huus2vyu1#

该错误指向外部的东西,而不是您的代码-特别是如果它以前工作。
请检查防火墙设置和套接字端口,并检查要连接的服务器是否处于活动状态。

kb5ga3dv

kb5ga3dv2#

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

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

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

DNS问题?

  1. host OGN2.OnlineGamesNet.net

路由问题?

  1. traceroute 79.110.87.154

尝试完整TCP握手

  1. telnet OGN2.OnlineGamesNet.net 6667
展开查看全部

相关问题