当前位置: 首页>>代码示例>>PHP>>正文


PHP connection::setSocketClass方法代码示例

本文整理汇总了PHP中connection::setSocketClass方法的典型用法代码示例。如果您正苦于以下问题:PHP connection::setSocketClass方法的具体用法?PHP connection::setSocketClass怎么用?PHP connection::setSocketClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在connection的用法示例。


在下文中一共展示了connection::setSocketClass方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     $this->error = false;
     if ($this->loadConfig() === false) {
         $this->error = true;
         return;
     }
     $conn = new connection(null, $this->port, 0);
     $conn->setSocketClass($this->socketClass);
     $conn->setIrcClass($this->ircClass);
     $conn->setCallbackClass($this);
     $conn->setTimerClass($this->timerClass);
     $conn->setTransTimeout(15);
     $conn->init();
     if ($conn->getError()) {
         $this->error == true;
         return;
     }
     $this->httpListener = $conn;
     $this->html = $this;
 }
开发者ID:Gulerod,项目名称:php-irc,代码行数:21,代码来源:httpd_mod.php

示例2: init

 public function init()
 {
     $this->error = false;
     if ($this->loadConfig() === false) {
         $this->error = true;
         return;
     }
     $conn = new connection(null, $this->port, 0);
     $conn->setSocketClass($this->socketClass);
     $conn->setIrcClass($this->ircClass);
     $conn->setCallbackClass($this);
     $conn->setTimerClass($this->timerClass);
     $conn->setTransTimeout(15);
     $conn->init();
     if ($conn->getError()) {
         $this->error == true;
         return;
     }
     $this->httpListener = $conn;
     //$this->timerClass->addTimer("httpd_check_listeners", $this, "handleSessions", "", 0.25, false);
 }
开发者ID:Gulerod,项目名称:php-irc,代码行数:21,代码来源:httpd_mod.php

示例3: connect

 public function connect()
 {
     if ($this->host == null || $this->port == null) {
         return false;
     }
     if (!is_object($this->socketClass)) {
         return false;
     }
     if (!is_object($this->ircClass)) {
         return false;
     }
     $conn = new connection($this->host, $this->port, CONNECT_TIMEOUT);
     $conn->setSocketClass($this->socketClass);
     $conn->setIrcClass($this->ircClass);
     $conn->setCallbackClass($this);
     $conn->setTimerClass($this->timerClass);
     /* Set Timeouts */
     $conn->setTransTimeout($this->transTimeout);
     $conn->init();
     if ($conn->getError()) {
         $this->setError("Could not allocate socket");
         return false;
     }
     $this->sockInt = $conn->getSockInt();
     $conn->connect();
     $this->connection = $conn;
     return true;
 }
开发者ID:Gulerod,项目名称:php-irc,代码行数:28,代码来源:remote.php

示例4: onAccept

 private function onAccept()
 {
     //Get the sockInt from the socketClass
     $newSockInt = $this->socketClass->hasAccepted($this->sockInt);
     if ($newSockInt === false) {
         //False alarm.. just ignore it.
         return false;
     }
     //Create a new connection object for the new socket connection, then return it to onAccept
     //We must assume that onAccept will handle the connection object.  Otherwise it'll die, and the
     //connection will be orphaned.
     $newConn = new connection(null, null, 0);
     $newConn->setSocketClass($this->socketClass);
     $newConn->setIrcClass($this->ircClass);
     $newConn->setCallbackClass($this->callbackClass);
     //Can be overwritten in the onAccept function
     $newConn->setTimerClass($this->timerClass);
     $newConn->listen();
     //We don't need to call init(), we're already setup.
     //Setup our connection transmission timeout thing.
     if ($this->transTimeout > 0) {
         $this->timerClass->addTimer(irc::randomHash(), $newConn, "transTimeout", "", $this->transTimeout);
     }
     $newConn->setTransTimeout($this->transTimeout);
     //Set handler for our new sockInt to new connection class
     $this->socketClass->setHandler($newSockInt, $this->ircClass, $newConn, "handle");
     //Set our new sockInt
     $newConn->setSockInt($newSockInt);
     //Call our callback function for accepting with old object, and new object.
     $this->callbackClass->onAccept($this, $newConn);
     return false;
 }
开发者ID:Gulerod,项目名称:php-irc,代码行数:32,代码来源:connection.php

示例5: addFile

 public function addFile($nick, $host, $port, $type, $filename, $size, $fromTimer = false)
 {
     $reverse = false;
     if ($this->ircClass->getClientConf("mircdccreverse") != "" && $fromTimer == false && $type != DOWNLOAD) {
         $port = intval($this->ircClass->getClientConf("mircdccreverse"));
         if ($port == 0) {
             return NULL;
         }
         $args = new argClass();
         $args->arg1 = $nick;
         $args->arg2 = $host;
         $args->arg3 = $port;
         $args->arg4 = $type;
         $args->arg5 = $filename;
         $args->arg6 = $size;
         $args->arg7 = time();
         $args->arg8 = FILE;
         $this->ircClass->notice($nick, "DCC: NOTICE: This server is using the mIRC File Server Protocol.  Please use ' /dccserver +s on " . $this->ircClass->getClientConf("mircdccreverse") . " ' to recieve files from me!  Starting 6 second delay...", 0);
         $this->ircClass->sendRaw("WHOIS " . $nick);
         $this->timerClass->addTimer(irc::randomHash(), $this, "reverseTimer", $args, 6);
         return;
     }
     if ($fromTimer == true) {
         $reverse = DCC_REVERSE;
         // using mIRC dcc reverse protocol
     }
     if ($host == NULL || $port == NULL) {
         $conn = new connection(null, null, 0);
         $listening = true;
         $status = DCC_LISTENING;
     } else {
         $conn = new connection($host, $port, CONNECT_TIMEOUT);
         $listening = false;
         $status = DCC_CONNECTING;
     }
     $conn->setSocketClass($this->socketClass);
     $conn->setIrcClass($this->ircClass);
     $conn->setCallbackClass($this);
     $conn->setTransTimeout(30);
     $conn->setTimerClass($this->timerClass);
     $port = $conn->init();
     if ($conn->getError()) {
         $this->ircClass->log("File transfer start error: " . $conn->getErrorMsg());
         return false;
     }
     $sockInt = $conn->getSockInt();
     $id = $this->highestId();
     $file = new file($id, $nick, $sockInt, $host, $port, $type, $reverse);
     if ($file->transferType == UPLOAD) {
         $this->fileUlCount++;
     } else {
         $this->fileDlCount++;
     }
     $file->setIrcClass($this->ircClass);
     $file->setDccClass($this);
     $file->setSocketClass($this->socketClass);
     $file->setProcQueue($this->procQueue);
     $file->setTimerClass($this->timerClass);
     $file->connection = $conn;
     $file->status = $status;
     $file->removed = false;
     $this->dccList[$sockInt] = $file;
     $file->initialize($filename, $size);
     $conn->setCallbackClass($file);
     if ($listening == true) {
         $this->timerClass->addTimer(irc::randomHash(), $this, "checkDccTimeout", $file, 30, true);
     }
     if ($reverse == true) {
         $conn->connect();
     }
     return $port;
 }
开发者ID:tseeker,项目名称:LWB5,代码行数:72,代码来源:dcc.php

示例6: reconnect

 public function reconnect()
 {
     $this->updateContext();
     try {
         $this->connectStartTime = time();
         $conn = new connection($this->getClientConf('server'), $this->getClientConf('port'), CONNECT_TIMEOUT);
         $this->conn = $conn;
         $conn->setSocketClass($this->socketClass);
         $conn->setIrcClass($this);
         $conn->setCallbackClass($this);
         $conn->setTimerClass($this->timerClass);
         $conn->init();
         if ($conn->getError()) {
             throw new ConnectException($conn->getErrorMsg());
         }
         //Bind socket...
         if ($this->getClientConf('bind') != "") {
             $conn->bind($this->getClientConf('bind'));
         }
         $this->sockInt = $conn->getSockInt();
         $conn->connect();
     } catch (ConnectException $e) {
         $this->beginReconnectTimer();
         $this->status = STATUS_ERROR;
         $this->exception = $e;
         return;
     }
     $this->status = STATUS_CONNECTING;
     $this->updateContext();
     return;
 }
开发者ID:Gulerod,项目名称:php-irc,代码行数:31,代码来源:irc.php


注:本文中的connection::setSocketClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。