createTcpConnection("raw_input"); $srv->bind("localhost", 7777); $srv->listen(); $sock = $pool->createTcpConnection("freenode"); $sock->bind("192.168.0.101", 5456); $sock->connect("irc.freenode.net", 6667); $got_001 = FALSE; $lines = 0; $i = 0; $authed = FALSE; $joined = FALSE; while(TRUE) { $select = $pool->select(); while($read = $sock->read()) { $pool->writeToGroup("raw_input", $read); if(preg_match("/001/", $read)) $got_001 = TRUE; $lines++; } if(!$authed && $lines > 1) { $sock->write("USER as as as :Asdfg\r\n"); $sock->write("NICK :phptbt42\r\n"); $authed = TRUE; } if($got_001 && !$joined) { $joined = TRUE; $sock->write("JOIN #mstasty\r\n"); //$sock->write("PRIVMSG #mstasty :SocketTest abgeschlossen!\r\n"); } echo $i++ . " ---\n"; } ?>