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


PHP FSockOpen函数代码示例

本文整理汇总了PHP中FSockOpen函数的典型用法代码示例。如果您正苦于以下问题:PHP FSockOpen函数的具体用法?PHP FSockOpen怎么用?PHP FSockOpen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: Open

 public function Open()
 {
     if (!$this->RconSocket) {
         $this->RconSocket = @FSockOpen($this->Socket->Address, $this->Socket->Port, $ErrNo, $ErrStr, $this->Socket->Timeout);
         if ($ErrNo || !$this->RconSocket) {
             throw new SocketException('Can\'t connect to RCON server: ' . $ErrStr, SocketException::CONNECTION_FAILED);
         }
         Stream_Set_Timeout($this->RconSocket, $this->Socket->Timeout);
         Stream_Set_Blocking($this->RconSocket, true);
     }
 }
开发者ID:jelakesh,项目名称:PHP-Source-Query,代码行数:11,代码来源:SourceRcon.php

示例2: Open

 public function Open()
 {
     if (!$this->RconSocket) {
         $this->RconSocket = @FSockOpen($this->Socket->Ip, $this->Socket->Port, $ErrNo, $ErrStr, $this->Socket->Timeout);
         if ($ErrNo || !$this->RconSocket) {
             throw new TimeoutException('Can\'t connect to RCON server: ' . $ErrStr, TimeoutException::TIMEOUT_CONNECT);
         }
         Stream_Set_Timeout($this->RconSocket, $this->Socket->Timeout);
         Stream_Set_Blocking($this->RconSocket, true);
     }
 }
开发者ID:ezpz-cz,项目名称:web-pages,代码行数:11,代码来源:SourceRcon.class.php

示例3: Open

 public function Open()
 {
     if (!$this->RconSocket && $this->Socket->Engine == CI_SourceQuery::SOURCE) {
         $this->RconSocket = @FSockOpen($this->Socket->Ip, $this->Socket->Port, $ErrNo, $ErrStr, $this->Socket->Timeout);
         if ($ErrNo || !$this->RconSocket) {
             throw new SourceQueryException('Can\'t connect to RCON server: ' . $ErrStr);
         }
         Stream_Set_Timeout($this->RconSocket, $this->Socket->Timeout);
         Stream_Set_Blocking($this->RconSocket, true);
     }
 }
开发者ID:mefisto2009,项目名称:GameAP,代码行数:11,代码来源:Rcon.class.php

示例4: Connect

 public function Connect($Ip, $Port = 25575, $Password, $Timeout = 3)
 {
     $this->RequestId = 0;
     if ($this->Socket = FSockOpen($Ip, (int) $Port)) {
         Socket_Set_TimeOut($this->Socket, $Timeout);
         if (!$this->Auth($Password)) {
             $this->Disconnect();
         } else {
             return true;
         }
     }
 }
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:12,代码来源:MinecraftRcon.class.php

示例5: Connect

 public function Connect($Ip, $Port = 25575, $Password, $Timeout = 3)
 {
     $this->RequestId = 0;
     if ($this->Socket = @FSockOpen($Ip, (int) $Port)) {
         Socket_Set_TimeOut($this->Socket, $Timeout);
         if (!$this->Auth($Password)) {
             $this->Disconnect();
             throw new MinecraftRconException("Authorization failed, password is wrong.");
         }
     } else {
         throw new MinecraftRconException("Can`t connect to MC server.");
     }
 }
开发者ID:BONNe,项目名称:MinecraftVoter,代码行数:13,代码来源:minecraftrcon.php

示例6: Connect

 public function Connect($Ip, $Port = 25575, $Password, $Timeout = 3)
 {
     $this->RequestId = 0;
     if ($this->Socket = @FSockOpen($Ip, (int) $Port, $errno, $errstr, $Timeout)) {
         Socket_Set_TimeOut($this->Socket, $Timeout);
         if (!$this->Auth($Password)) {
             $this->Disconnect();
             throw new MinecraftRconException("Authorization failed.");
         }
     } else {
         throw new MinecraftRconException("Server offline");
     }
 }
开发者ID:qexyorg,项目名称:webMCR-1,代码行数:13,代码来源:rcon.class.php

示例7: Connect

 public function Connect($Ip, $Port = 25575, $Password, $Timeout = 3)
 {
     $this->RequestId = 0;
     if ($this->Socket == FSockOpen($Ip, (int) $Port)) {
         Socket_Set_TimeOut($this->Socket, $Timeout);
         if (!$this->Auth($Password)) {
             $this->Disconnect();
             throw new MinecraftRconException("Неудалось авторизироваться.");
         }
     } else {
         throw new MinecraftRconException("Сервер недоступен.");
     }
 }
开发者ID:Kistriver,项目名称:craftengine0,代码行数:13,代码来源:MinecraftRcon.class.php

示例8: Connect

 public function Connect($Ip, $Port = 25575, $Password, $Timeout = 3)
 {
     $this->RequestId = 0;
     if ($this->Socket = FSockOpen($Ip, (int) $Port)) {
         Socket_Set_TimeOut($this->Socket, $Timeout);
         if (!$this->Auth($Password)) {
             $this->Disconnect();
             throw new MinecraftRconException("Authorization failed.");
         }
     } else {
         throw new MinecraftQueryException("Can't open socket.");
     }
 }
开发者ID:nxarmada,项目名称:PHP-Minecraft-Query,代码行数:13,代码来源:MinecraftRcon.class.php

示例9: Open

 public function Open($Address, $Port, $Timeout, $Engine)
 {
     $this->Timeout = $Timeout;
     $this->Engine = $Engine;
     $this->Port = $Port;
     $this->Address = $Address;
     $this->Socket = @FSockOpen('udp://' . $Address, $Port, $ErrNo, $ErrStr, $Timeout);
     if ($ErrNo || $this->Socket === false) {
         throw new SocketException('Could not create socket: ' . $ErrStr, SocketException::COULD_NOT_CREATE_SOCKET);
     }
     Stream_Set_Timeout($this->Socket, $Timeout);
     Stream_Set_Blocking($this->Socket, true);
 }
开发者ID:jelakesh,项目名称:PHP-Source-Query,代码行数:13,代码来源:Socket.php

示例10: Open

 public function Open($Ip, $Port, $Timeout, $Engine)
 {
     $this->Timeout = $Timeout;
     $this->Engine = $Engine;
     $this->Port = $Port;
     $this->Ip = $Ip;
     $this->Socket = @FSockOpen('udp://' . $Ip, $Port, $ErrNo, $ErrStr, $Timeout);
     if ($ErrNo || $this->Socket === false) {
         throw new Exception('Could not create socket: ' . $ErrStr);
     }
     Stream_Set_Timeout($this->Socket, $Timeout);
     Stream_Set_Blocking($this->Socket, true);
     return true;
 }
开发者ID:mefisto2009,项目名称:GameAP,代码行数:14,代码来源:Socket.class.php

示例11: Connect

 public function Connect($Ip, $Port = 25565, $Timeout = 3)
 {
     if ($this->Socket = FSockOpen('udp://' . $Ip, (int) $Port)) {
         Socket_Set_TimeOut($this->Socket, $Timeout);
         $Challenge = $this->GetChallenge();
         if ($Challenge === false) {
             FClose($this->Socket);
             return false;
         }
         if (!$this->GetStatus($Challenge)) {
             FClose($this->Socket);
             return false;
         }
         FClose($this->Socket);
         return true;
     } else {
         return false;
     }
 }
开发者ID:CrystReal,项目名称:Site_frontend,代码行数:19,代码来源:MinecraftQuery.php

示例12: Connect

 public function Connect($Ip, $Port = 25565, $Timeout = 3)
 {
     if (!is_int($Timeout) || $Timeout < 0) {
         throw new InvalidArgumentException('Timeout must be an integer.');
     }
     $this->Socket = @FSockOpen('udp://' . $Ip, (int) $Port, $ErrNo, $ErrStr, $Timeout);
     if ($ErrNo || $this->Socket === false) {
         throw new MinecraftQueryException('Could not create socket: ' . $ErrStr);
     }
     Stream_Set_Timeout($this->Socket, $Timeout);
     Stream_Set_Blocking($this->Socket, true);
     try {
         $Challenge = $this->GetChallenge();
         $this->GetStatus($Challenge);
     } catch (MinecraftQueryException $e) {
         FClose($this->Socket);
         throw new MinecraftQueryException($e->getMessage());
     }
     FClose($this->Socket);
 }
开发者ID:0651,项目名称:Cyanide-Services,代码行数:20,代码来源:MinecraftQuery.class.php


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