Jump to content

PHP IRC keeps leaving


konnwat

Recommended Posts

Are you able to output or log the incomming server text?

Perhaps it will tell you why you're the bot is timing out?
I haven't used php sockets but I have done my own IRC Client with VB.NEt and I can toggle on/off the parsing of the IRC server text.  Sometimes it can give you clues as to why you connection drops/timesout.

[quote author=SharkBait link=topic=123057.msg508762#msg508762 date=1169235895]
Are you able to output or log the incomming server text?

Perhaps it will tell you why you're the bot is timing out?
I haven't used php sockets but I have done my own IRC Client with VB.NEt and I can toggle on/off the parsing of the IRC server text.  Sometimes it can give you clues as to why you connection drops/timesout.


[/quote]

yes i can, i said this in a previous post. there seems to be no common link of why my bot is leaving.
okay i got it,it seems for no reason my bot runs the whole script again and again every now and then :P

this is my connect code.

[code]
<?php
set_time_limit(0);

//set vars
$host = 'irc.barafranca.com';
$port = '6667';
$nickname = "Bot";
$channel = file('../bot/channels.txt');

//open data.txt and botlines.txt
$cokehandle = fopen('../coke/data.txt', w);

$lineshandle = fopen('../botlines.txt', a);
fwrite($lineshandle, "\n\n\n");

$killmode['#chan'] = 'on';
$ks = array();

//connect to IRC
$socket = fsockopen($host, $port);
stream_set_timeout($socket, 60*60*24*365);
fwrite($socket, "NICK ".$nickname."\r\n");
fwrite($socket, "USER ".$nickname." 8 * :Nick's Bot\r\n");
fwrite($socket, "MODE ".$nickname." +B\r\n");
while ($line=fgets($socket)) {
  if (strpos($line, "433")>0) die();
  if (strpos($line, "004")>0) {
      $chancount = count($channel);
      fwrite($socket, "PRIVMSG nickserv :IDENTIFY Bot hello123\r\n");
      for ($i = 0; $i < $chancount; $i++) {
            fwrite($socket, "JOIN ".$channel[$i]."\r\n");
      }
      break;
  }
}

?>[/code]

there is a [color=blue]$lineshandle[/color]  to log my lines and there are a lot of random "\n\n\n" in the middle of all the lines. this must mean that my whole php script just randomly starts again after a while :s and some times is give me an EOF because it doent run again, it just ends :P

how do i stop this?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.