Using ServerTravel on a dedicated server causes clients on MacOS to disconnect

Hello.

I have a dedicated server built and running on Linux, it runs fine and both my Mac and Windows clients are able to connect to it, in the server there is a timer of 5 minutes, when it runs out, it executes the console command “ServerTravel mainMap” which is the same map the server was already on.
What happens is my Windows clients would remain on the server and the map and game will restart, and my MacOS clients would see that the map is loading again, their camera would be at the world origin position for a second, and then they are kicked back to the main menu. In the logs I see that Logout was called.

I’m not sure exactly what is going on or how to even debug this, is there a known issue with MacOS clients loading a map from the dedicated server calling ServerTravel?

I am using UE 5.1 built from source, building clients for Windows and MacOS and a server for Linux.

For more clarity, here are some logs I am seeing on the client that disconnects:

LogNet: UIpConnection::HandleSocketSendResult: Socket->SendTo failed with error 10 (SE_ENOTSOCK). [UNetConnection] RemoteAddr: 15.222.34.95:9000, Name: IpConnection_2, Driver: GameNetDriver IpNetDriver_2, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: NULL:bh-francol-mbp-517E47B3004B416E1062CD963C4536B4 Connection beginning close timeout (Timeout = 0).
LogNet: UIpNetDriver::TickDispatch: Socket->RecvFrom: 10 (SE_ENOTSOCK) from 0.0.0.0:0. [UNetConnection] RemoteAddr: 15.222.34.95:9000, Name: IpConnection_2, Driver: GameNetDriver IpNetDriver_2, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: NULL:bh-francol-mbp-517E47B3004B416E1062CD963C4536B4 Connection beginning close timeout (Timeout = 0).
LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionLost, ErrorString = UIpNetDriver::TickDispatch: Socket->RecvFrom: 10 (SE_ENOTSOCK) from 0.0.0.0:0, Driver = GameNetDriver IpNetDriver_2
LogNet: Warning: Network Failure: GameNetDriver[ConnectionLost]: UIpNetDriver::TickDispatch: Socket->RecvFrom: 10 (SE_ENOTSOCK) from 0.0.0.0:0
LogNet: NetworkFailure: ConnectionLost, Error: 'UIpNetDriver::TickDispatch: Socket->RecvFrom: 10 (SE_ENOTSOCK) from 0.0.0.0:0'
LogNet: UNetConnection::Close: [UNetConnection] RemoteAddr: 15.222.34.95:9000, Name: IpConnection_2, Driver: GameNetDriver IpNetDriver_2, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: NULL:bh-francol-mbp-517E47B3004B416E1062CD963C4536B4, Channels: 2, Time: 2023.10.17-17.35.00
LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 15.222.34.95:9000, Name: IpConnection_2, Driver: GameNetDriver IpNetDriver_2, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: NULL:bh-francol-mbp-517E47B3004B416E1062CD963C4536B4
LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionLost, ErrorString = UIpNetConnection::HandleSocketSendResult: Socket->SendTo failed with error 10 (SE_ENOTSOCK). [UNetConnection] RemoteAddr: 15.222.34.95:9000, Name: IpConnection_2, Driver: GameNetDriver IpNetDriver_2, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: NULL:bh-francol-mbp-517E47B3004B416E1062CD963C4536B4 Connection will be closed during next Tick()!, Driver = GameNetDriver IpNetDriver_2
LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionLost, ErrorString = Your connection to the host has been lost., Driver = GameNetDriver IpNetDriver_2
LogNet: Warning: Encountered an error, cleaning up this connection now
LogNet: Browse: /Game/Maps/MainMenu?closed
LogNet: Connection failed; returning to Entry

@RandomCouch Did you ever find out what was causing this? I have seen the same error in the same scenario with MacOS clients.

Same exact issue here

@BFSKyle I unfortunately have not, I just stopped using the ServerTravel console command and changed my projects flow a bit to circumvent having to use it. Now I just have a system that will shut down my server when the timer runs out and users get sent back to a lobby where they can start a new game/server

Try this.
In Engine/Source/Runtime/Sockets/Private/Mac/SocketSubsystemMac.h function Close. replace it with

if (Socket != INVALID_SOCKET)
		{
			int32 error = closesocket(Socket);
			Socket = INVALID_SOCKET;
			return error == 0;
		}
		return false;

Hi,

I am a beginner when it comes to multiplayer, and I am using MacOS, and I think the same issue applies to my listen server setup.

I tried @wukaki’s solution, but it only worked the first time around, so I tried manually avoiding using servertravel and instead destroying the current session → creating a new session → having the client search for that new session → joining the session with the same server ID as the created one. However, I think to have to have a client execute code on command from the server, it has to be connected to the server, but to have the server create a new session, it can’t be already in one.

is there a workaround to Servertravel that I could use to transport my players from the lobby to the actual map?

Please help.

you need to provide the logs when looking for help. My solution is used to solve Socket->SendTo failed with error 2 (SE_EBADF) bad file description problem. It causes problem when the GC try to recycle net connection but the socket is currently in use. because unreal doesn’t recycle the socket on time and it’s being reused.
I don’t know much about your issue. it could be as same as mine. Or maybe it’s totally different problem and just act same (disconnect or crash).

Hi,

Thanks for your detailed explanation.

Here are the log errors that show up when ServerTravel is called:

LogNet: Client netspeed is 100000

LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionLost, ErrorString = UIpNetDriver::TickDispatch: Socket->RecvFrom: 10 (SE_ENOTSOCK) from 0.0.0.0:0, Driver = Name:GameNetDriver Def:GameNetDriver IpNetDriver_6

LogNet: Warning: Network Failure: GameNetDriver[ConnectionLost]: UIpNetDriver::TickDispatch: Socket->RecvFrom: 10 (SE_ENOTSOCK) from 0.0.0.0:0

LogNet: NetworkFailure: ConnectionLost, Error: ‘UIpNetDriver::TickDispatch: Socket->RecvFrom: 10 (SE_ENOTSOCK) from 0.0.0.0:0’

LogNet: UNetConnection::Close: [UNetConnection] RemoteAddr: 192.168.1.7:7777, Name: IpConnection_5, Driver: Name:GameNetDriver Def:GameNetDriver IpNetDriver_6, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: NULL:MacBook-Pro.local-F8ADC6E9FF4AA41543367F83A538E7A4, Channels: 3, Time: 2025.06.06-12.06.30

LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 192.168.1.7:7777, Name: IpConnection_5, Driver: Name:GameNetDriver Def:GameNetDriver IpNetDriver_6, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: NULL:MacBook-Pro.local-F8ADC6E9FF4AA41543367F83A538E7A4

LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionLost, ErrorString = UIpNetConnection::HandleSocketSendResult: Socket->SendTo failed with error 10 (SE_ENOTSOCK). [UNetConnection] RemoteAddr: 192.168.1.7:7777, Name: IpConnection_5, Driver: Name:GameNetDriver Def:GameNetDriver IpNetDriver_6, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: NULL:Jags-MacBook-Pro.local-F8ADC6E9FF4AA41543367F83A538E7A4 Connection will be closed during next Tick()!, Driver = Name:GameNetDriver Def:GameNetDriver IpNetDriver_6

LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionLost, ErrorString = Your connection to the host has been lost., Driver = Name:GameNetDriver Def:GameNetDriver IpNetDriver_6

LogNet: Warning: Encountered an error, cleaning up this connection now

I apologize in advance if I made some kind of mistake that caused this.
Thanks for being patient with me.

your case is ENOTSOCK. which means the file description it’s not a socket.
a probably reason of this error happens is because the socket is closed for some reason and the file description is reassigned to another operation which is not socket. So, for some reason, the socket is closed but FSocketMac is not destroyed. and the net drive keep using the old FSocketMac to connect the new session.

which unreal engine version are you using? which platform is it?

if you want to debug this issue, you can also print stack trace dump in FSocketMac::Close function and FSocketMac’s construction. there must be some where called socket close function but didn’t destroy connection in engine source.

Hi,

I am using Unreal Engine 5.5 on a mac Sonoma 14.6.1.

Since I am quite inexperienced when it comes to debugging sockets, how would I go about printing the stack trace dump in the socket’s construction? Would there be a way to just manually destroy the old FSocketMac so the engine knows to use another socket?

my idea is to delete the old FSocketMac too. but we need to know when to delete it properly.
First, you need to use unreal engine source code. I believe you are already using.
So, in Engine/Source/Runtime/Sockets/Private/Mac/SocketSubsystemMac.h there are construction, deconstruction and Close function. We first add #include "Misc/AssertionMacros.h"to the include list. and then add FDebug::DumpStackTraceToLog(ELogVerbosity::Type::Warning) to these three functions to print stack trace to log file.
and then, compile unreal engine source. and use the compiled engine to build a client and test. it will print when the FSocketMac is created, destroyed and closed.
If you share the log with me, then I can help you analyze it.

Thanks for the quick response.

I don’t see the construction or deconstruction function you are talking about.
Do you mean to put

FDebug::DumpStackTraceToLog(ELogVerbosity::Type::Warning)

after the

**static** FSocketSubsystemMac* Create();

after the

**static** **void** Destroy();

and inside the

**virtual** **bool** Close() **override**

?

Also, (this might be a dumb question, but) why can’t we just delete the FSocketMac whenever ServerTravel is called?