/** * * @return telnetConnect */ static public function instance(){ if ( is_null(self::$instance) ) { self::$instance = new self; $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_set_nonblock($socket); socket_connect($socket, MUD_ADDRESS, MUD_PORT); self::$instance->socket = $socket; self::$instance->memory = new Memcache(); self::$instance->memory->addServer('localhost', 11211); self::$instance->readMemoryOnce(); } else{ die ('F**K!! IN [FILE: '.__FILE__.'] AT [LINE: '.__LINE__.']'); } return self::$instance; }
<?php require_once ('telnetConnet.php'); $telnetConnect = telnetConnect::instance(); $telnetConnect->botConnect(); $telnetConnect->socketRead(); ?>