This document is about: SERVER 5
SWITCH TO

This page is a work in progress and could be pending updates.

Firewall Settings

If you are running a local Photon Server and noticed a bad event rate then this is most likely caused by logging. For instance, we noticed that enabling both Photon Server logging and Windows Defender may cause the event rate to slow down considerably. That is why we recommend disabling all virus scanners and firewalls when enabling Photon logging so you can have the expected events rate. You can re-enable the virus scanners and firewalls once you stop logging on Photon Servers.

如果Photon需要從遠程機器上訪問(特別是通過網路),請確保您的防火牆沒有阻止連接。

強制性的默認端口列在本頁面

要檢查設置,在Windows控制面板中打開Windows防火牆。 點擊 "允許程序通過Windows防火牆",確認 "PhotonSocketServer "被列出並被選中。

photon server: firewall settings
Photon Server: Firewall Settings

您可以利用這個PowerShell腳本來打開Photon伺服器使用的所有默認端口:

Unknown

$fw = New-Object -ComObject hnetcfg.fwpolicy2 
$ruleTcp = New-Object -ComObject HNetCfg.FWRule
$ruleUdp = New-Object -ComObject HNetCfg.FWRule

$ruleTcp.Name = "Photon SocketServer TCP"
$ruleTcp.Protocol = 6 #NET_FW_IP_PROTOCOL_TCP
$ruleTcp.LocalPorts = "80,443,843,943,4520-4522,4530-4533,4540,4541,6060-6063,9090-9093,19090-19093"
$ruleTcp.Enabled = $true

$ruleTcp.Profiles = 7 #all
$ruleTcp.Action = 1 # NET_FW_ACTION_ALLOW

$ruleUdp.Name = "Photon SocketServer UDP"
$ruleUdp.Protocol = 17 #NET_FW_IP_PROTOCOL_Udp
$ruleUdp.LocalPorts = "5055-5058,40001,27000-27003"
$ruleUdp.Enabled = $true

$ruleUdp.Profiles = 7 #all
$ruleUdp.Action = 1 # NET_FW_ACTION_ALLOW

$fw.Rules.Add($ruleTcp)
$fw.Rules.Add($ruleUdp)
Back to top