◆ PortForward()
static PortForward |
( |
|
$port | ) |
|
|
static |
- Parameters
-
- Returns
- bool
40 if(
Utils::getOS() !=
"win" or !class_exists(
"COM",
false)){
44 $myLocalIP = gethostbyname(trim(`hostname`));
46 $com = new \COM(
"HNetCfg.NATUPnP");
47 if($com ===
false or !is_object($com->StaticPortMappingCollection)){
50 $com->StaticPortMappingCollection->Add($port,
"UDP", $port, $myLocalIP,
true,
"PocketMine-MP");
51 }
catch(\Throwable $e){
◆ RemovePortForward()
static RemovePortForward |
( |
|
$port | ) |
|
|
static |
- Parameters
-
- Returns
- bool
72 $com = new \COM(
"HNetCfg.NATUPnP") or false;
73 if($com === false or !is_object($com->StaticPortMappingCollection)){
76 $com->StaticPortMappingCollection->Remove($port,
"UDP");
77 }
catch(\Throwable $e){
The documentation for this class was generated from the following file:
- src/pocketmine/network/upnp/UPnP.php