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.

If Photon should be accessible from remote machines (especially through the internet), make sure your firewalls do not block connections.

Mandatory default ports are listed at this page.

To check settings, open the Windows Firewall in the Windows Control Panel. Click "Allow a program through Windows Firewall" and verify "PhotonSocketServer" is listed and checked.

photon server: firewall settings
Photon Server: Firewall Settings

You can make use of this PowerShell script to open all default ports used by Photon Server:

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