UE 5.4.3 , MacOSX, Shipping Build "Could not create socket for bind address" and "Error initializing network layer."

Hi,
I’m in the process of updating our project from 5.1.1 to 5.4.3. We use a dedicated server setup.

This problem happens only when the client is built in shipping mode. The client can connect fine to the server if I launch it through the editor.

Testing the new upgraded release on Mac, the client cannot connect to the server. It worked in past UE releases, and it works on Windows/Linux releases, same code. Below you see the comparison of the log between Windows
(which is connecting finr) and Mac. Now in UE 5.4.3 as soon as my client connects to the server it’s failing with “Could not create socket for bind address” and then “Error initializing network layer.”


==WINDOWS==
[2024.08.23-16.35.13:653][360]LogNet: Registering network metrics listener /Script/Engine.NetworkMetricsPerfCounters for metric AddedConnections
[2024.08.23-16.35.13:653][360]LogInit: WinSock: Socket queue. Rx: 32768 (config 32768) Tx: 32768 (config 32768)
[2024.08.23-16.35.13:653][360]LogNet: Created socket for bind address: 0.0.0.0:0
[2024.08.23-16.35.13:654][360]LogNet: IpConnection_1 setting maximum channels to: 32767
[2024.08.23-16.35.13:654][360]PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)
[2024.08.23-16.35.13:655][360]LogHandshake: Stateless Handshake: NetDriverDefinition 'GameNetDriver' CachedClientID: 5
[2024.08.23-16.35.13:656][360]LogNet: Game client on port 7777, rate 100000
[2024.08.23-16.35.18:269][498]LogHandshake: Cached server SessionID: 0
[2024.08.23-16.35.18:269][498]LogHandshake: SendChallengeResponse. Timestamp: 0.034097, Cookie: 231151032107096000247060075191220087254159111136144025242055
[2024.08.23-16.35.18:270][498]LogHandshake: Cached server SessionID: 0
[2024.08.23-16.35.18:273][499]LogHandshake: SendChallengeResponse. Timestamp: 0.034097, Cookie: 231151032107096000247060075191220087254159111136144025242055
[2024.08.23-16.35.18:276][499]LogHandshake: Cached server SessionID: 0
[2024.08.23-16.35.18:276][499]LogHandshake: SendChallengeResponse. Timestamp: 0.034097, Cookie: 231151032107096000247060075191220087254159111136144025242055
[2024.08.23-16.35.18:278][499]LogHandshake: Cached server SessionID: 0
[2024.08.23-16.35.18:282][499]LogHandshake: SendChallengeResponse. Timestamp: 0.034097, Cookie: 231151032107096000247060075191220087254159111136144025242055
[2024.08.23-16.35.19:302][529]LogHandshake: SendChallengeResponse. Timestamp: 0.034097, Cookie: 231151032107096000247060075191220087254159111136144025242055
[2024.08.23-16.35.20:335][560]LogHandshake: SendChallengeResponse. Timestamp: 0.034097, Cookie: 231151032107096000247060075191220087254159111136144025242055
[2024.08.23-16.35.21:336][590]LogHandshake: SendChallengeResponse. Timestamp: 0.034097, Cookie: 231151032107096000247060075191220087254159111136144025242055
[2024.08.23-16.35.22:169][615]LogNet: UPendingNetGame::SendInitialJoin: Sending hello. [UNetConnection] RemoteAddr: 127.0.0.1:7777, Name: IpConnection_1, Driver: Name:PendingNetDriver Def:GameNetDriver IpNetDriver_1, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID
[2024.08.23-16.35.22:402][622]LogNet: Welcomed by server (Level: /Game/Maps/MainWorld/Yliakum, Game: /Game/Blueprints/ServerGameMode.ServerGameMode_C)
[2024.08.23-16.35.22:402][622]LogLoad: LoadMap: 127.0.0.1/Game/Maps/MainWorld/Yliakum


==MAC==
[2024.08.24-01.12.52:120][ 92]LogNet: Registering network metrics listener /Script/Engine.NetworkMetricsPerfCounters for metric AddedConnections
[2024.08.24-01.12.52:122][ 92]LogInit: BSD IPv4/6: Socket queue. Rx: 32768 (config 32768) Tx: 32768 (config 32768)
[2024.08.24-01.12.52:122][ 92]LogNet: Warning: Could not create socket for bind address 0.0.0.0, got error BSD IPv4/6: binding to port 0 failed (48)
[2024.08.24-01.12.52:122][ 92]LogNet: Warning: Encountered an error while creating sockets for the bind addresses. 
[2024.08.24-01.12.52:122][ 92]LogNet: Error: InitBindSockets failed: 
[2024.08.24-01.12.52:122][ 92]LogNet: Warning: Failed to init net driver ConnectURL: pstest.ddns.net/Game/Maps/Client/ClientStartupMap: 
[2024.08.24-01.12.52:122][ 92]LogNet: Warning: error initializing the network stack
[2024.08.24-01.12.52:122][ 92]LogNet: DestroyNamedNetDriver IpNetDriver_2147482435 [PendingNetDriver]
[2024.08.24-01.12.52:122][ 92]LogGlobalStatus: Warning: BroadcastTravelFailure Travel failed, type: ETravelFailure::PendingNetGameCreateFailure, reason: "Error initializing network layer."
[2024.08.24-01.12.52:122][ 92]LogNet: Warning: Travel Failure: [PendingNetGameCreateFailure]: Error initializing network layer.
[2024.08.24-01.12.52:122][ 92]LogNet: TravelFailure: PendingNetGameCreateFailure, Reason for Failure: 'Error initializing network layer.'

I checked the firewall on MacOSX and it’s not active, I tried also from another machine, so I don’t think it’s something blocking the port.

I found the issue. Just for reference, the way I found out was to use the Console.app and filter on my app process, and I saw this message when the client was trying to connect:

“Operation not permitted” on com.apple.network

So I went back to XCode, and checked the app project settings and I found out under “Signing & Capabilities” → “App Sandbox” → Network → “Incoming/Outgoing connections” was actually ON for Debug and Test, but OFF for Shipping. No idea why that is the default, so I just turned it on also for Shipping and it worked.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.