Hulihrach icon

getavailableport

Hulihrach | PRO | 08/01/14 05:39:44 PM UTC | 0 ⭐ | 320 👁️ | Never ⏰ | []
PHP |

460 B

|

None

|

0 👍

/

0 👎

public function getAvailablePort(){
        $ports = $this->gameServer->gameServerDao->createQueryBuilder("gs")
            ->select("gs.port")
            ->where("status = ?1")
            ->andWhere("service_id = 4")
            ->setParameter(1, "active")
            ->getQuery()
            ->getArrayResult();
        
        for($i = $this->lowest_port; $i <= $this->highest_port; $i = $i+5){
            if(!array_key_exists($i, $ports)){
                return $i;
            }
        }
    }

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎