I am not too familiar with SmartIRC but i have been trying to use it with an UnReal IRC server. All i want SIRC to do is give me a list of names on a channel. This seems to "mostly" work:
include_once('SmartIRC/SmartIRC.php');
$irc = &new Net_SmartIRC(); $irc->setUseSockets(true); $irc->connect('192.168.1.101', 6667); $irc->login('Net_SmartIRC_Scanner', 'Net_SmartIRC Client', 0, 'Net_SmartIRC'); $irc->join(array('#TheSportsConnection')); $irc->names(array('#TheSportsConnection')); $resultar = $irc->listenFor(SMARTIRC_TYPE_NAME); $irc->disconnect();
$names = explode(" ",$resultar[0]);
foreach ($names as $key=>$name) { if ($name == "") unset ($names[$key]); if (stristr($name, "@")) $names[$key] = str_replace("@", "", $name); }
BUT - for some reason if i do a refresh on the page that holds this routine, after a few refreshes my Apache process pegs my CPU at 100%.
Any idea if i can use this with UnReal?
Any idea if this is the right way to get a list of names off a channel?
Any idea why it crashes Apache?
I have the latest CVS version of SIRC and i do have php sockets enabled.
thanks, Peter...
more info...
I tried running my page through my php debugger; and after the 4th refresh i get:
SmartIRC.php - line 1561 $rawdata = @socket_read($this->_socket, 10240);
socket_read() unable to read from socket (10053)
does this help anyone????
Try this:
<?php include_once('SmartIRC/SmartIRC.php');
$irc = &new Net_SmartIRC(); $irc->setDebug(SMARTIRC_DEBUG_NONE); $irc->setUseSockets(TRUE); $irc->connect('192.168.1.101', 6667); $irc->login('Net_SmartIRC', 'Net_SmartIRC Client', 0, 'Net_SmartIRC'); $irc->names(array('#TheSportsConnection'), SMARTIRC_MEDIUM); $resultar = $irc->objListenFor(SMARTIRC_TYPE_NAME); $irc->disconnect();
$usersonirc = $resultar[0]->messageex; foreach ($usersonirc as $value) { //do stuff here echo "$value<br />\n"; } ?>
Works fine for me, plenty of refreshes, no errors or crashes...
Scratch the above comment... after about 20 refreshes, I go the same result, apache freaked out and maxed out the cpu.
Something is drastically wrong with SmartIRC.
I seem to recall seeing something about sockets timeout settings causing this behaviour somewhere...
Log in to post a comment.
I am not too familiar with SmartIRC but i have been trying to use it with an UnReal IRC server. All i want SIRC to do is give me a list of names on a channel. This seems to "mostly" work:
include_once('SmartIRC/SmartIRC.php');
$irc = &new Net_SmartIRC();
$irc->setUseSockets(true);
$irc->connect('192.168.1.101', 6667);
$irc->login('Net_SmartIRC_Scanner', 'Net_SmartIRC Client', 0, 'Net_SmartIRC');
$irc->join(array('#TheSportsConnection'));
$irc->names(array('#TheSportsConnection'));
$resultar = $irc->listenFor(SMARTIRC_TYPE_NAME);
$irc->disconnect();
$names = explode(" ",$resultar[0]);
foreach ($names as $key=>$name) {
if ($name == "") unset ($names[$key]);
if (stristr($name, "@")) $names[$key] = str_replace("@", "", $name);
}
BUT - for some reason if i do a refresh on the page that holds this routine, after a few refreshes my Apache process pegs my CPU at 100%.
Any idea if i can use this with UnReal?
Any idea if this is the right way to get a list of names off a channel?
Any idea why it crashes Apache?
I have the latest CVS version of SIRC and i do have php sockets enabled.
thanks,
Peter...
more info...
I tried running my page through my php debugger; and after the 4th refresh i get:
SmartIRC.php - line 1561
$rawdata = @socket_read($this->_socket, 10240);
socket_read() unable to read from socket (10053)
does this help anyone????
Try this:
<?php
include_once('SmartIRC/SmartIRC.php');
$irc = &new Net_SmartIRC();
$irc->setDebug(SMARTIRC_DEBUG_NONE);
$irc->setUseSockets(TRUE);
$irc->connect('192.168.1.101', 6667);
$irc->login('Net_SmartIRC', 'Net_SmartIRC Client', 0, 'Net_SmartIRC');
$irc->names(array('#TheSportsConnection'), SMARTIRC_MEDIUM);
$resultar = $irc->objListenFor(SMARTIRC_TYPE_NAME);
$irc->disconnect();
$usersonirc = $resultar[0]->messageex;
foreach ($usersonirc as $value) {
//do stuff here
echo "$value<br />\n";
}
?>
Works fine for me, plenty of refreshes, no errors or crashes...
Scratch the above comment... after about 20 refreshes, I go the same result, apache freaked out and maxed out the cpu.
Something is drastically wrong with SmartIRC.
I seem to recall seeing something about sockets timeout settings causing this behaviour somewhere...