All pastes #901712 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-02-12 21:43 UTC
rendered paste body
<?

class connection {
        public $id = 1;
        public $localhost = "loli.catl.in";
        public $remotehost = "irc.deltaanime.net";
        public $nick = "Catlin";
        public $user = "Catlin";
        public $real = "Catlin";
        public $port = 6667;
        public $socket;

        function newc($id, $localhost, $remotehost, $port, $nick, $user, $real) {
                $this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
                socket_bind($this->socket, $localhost);
                socket_connect($this->socket, $remotehost, $port);

                socket_write($this->socket,"USER " . $real . " " . $localhost . " " . $real . " " . $real . "\r\n");
                socket_write($this->socket,"NICK " . $nick . "\r\n");

                socket_write($this->socket,"JOIN #annihilation\r\n");

                $this->readdata;
        }

        function readdata() {
                if ($rdata = socket_read($this->socket, 128)) {
                        echo $rdata;
                        flush();
                }
        }

}

        $IRC0 = new connection;
        $IRC1 = new connection;
        $IRC0->newc(0, "loli.catl.in", "irc.deltaanime.net", 6667, "Catlin", "Catlin", "Catlin");
        $IRC1->newc(1, "loli.catl.in", "irc.deltaanime.net", 6667, "Catlin2", "Catlin", "Catlin");

        while (1) {
                $IRC0->readdata();
                $IRC1->readdata();
        }

?>