A possible solution for connection issues

I couldn’t seem to find this solution on the internet, so I figured it out myself after quite some infuriating time. So, I’m writing this to hopefully let others know of a potential fix for when you are unable to have a stable connection, or just not connect to another’s server at all.

In my situation, I’ve experienced long loading times (endless), crashes, Socket Error Codes and getting disconnected a short while (a minute or so) after joining one of my friends’ servers. We all have the VPN Hamachi to stay on a network together. I could join one of my friends and stay on there with no issues, but not the other 2, when they hosted a server. If I tried to host, they would get disconnected after joining after driving around for a minute.
I thought mods were the issue at first, since I got stuck on specific mods on the rare occasion I was
actually loading in.

I tried reinstalling BeamNG, BeamMP, Hamachi, verifying files, having no mods, restarting my PC, having UPnP on and a whole lot more.

And then it struck me… The fix was going to my own network’s settings (Default Gateway - login etc.) [cmd → ipconfig → copying Default Gateway and pasting into a browser URL] On my network’s settings I could change the NAT type from “Symmetric” to “Post restricted cone”. I believe that in short these two just mean “Restricted” and “Open”, as I know from other troubleshooting stuff I’ve done. Switched to “Post retricted cone” and the problems were gone. I could connect with no problems, no slow loading time.

interesting. glad that helped you. unfortunately, this method isnt really that great, since literally everything around us usually uses symmetric NAT and for a good reason.

if you do get “failed to close socket”, then thatshowwindowssocketsworkyoucantryotheroperatingsystems or you could just ignore it, literally. for just ONLY that instant it couldnt close a socket, if you can play after that error message, then it closed and reopened successfully - there is “no” problem. but what if you want it gone for real?

oh, a friendly reminder: socket errors are more, lets say, prevalent for servers that are run on windows machines, linux servers (official servers) are actually less prone to such silly problems, if even at all, because thats the intended way, windows servers should be history now anyway. oh, you know, unix sockets > windows sockets. where was i?

ah yes, well i too want the beammp spaghetti netcode to be rewritten from scratch, its an utter mess and i hate it. but you know the saying, you know they aint gonna touch it. but that’s a bit inconvenient, isnt it? if you just wanna play, what can you even do?

firstly, you need to know that due to the way tcp/ip works, connections can not be closed immediately. take a look at your current list of ports and sockets in the cmd via "netstat -aon or you could use wireshark. pretty interesting numbers that mean nothing to you, right? well, start opening stuff, massively, like peoplpe do while playing beammp. run the command again, notice how much established connections there are now? chances are, a p2p torrent client has occupied a client 4444 port which is also used to connect to beammp servers. completely unbeknownst to average players.

and the best case scenario if you cant join at all since the port is established by another program, that is good actually. because if you could, you would get a “you have been disconnected from the server” message, not to be confused with the same message that you get as soon as you join, that one means your cpu was too slow to render every player vehicle at once and you timed out already in the loading screen.

also important to note: i hope one doesnt complain about socket problems while using a wifi connection, that would be hilarious. dont get me wrong, i dont have a super duper fibre optic internet, i just got a macbook and i get the same socket problems, but thats because of the unstable wifi that just gets interfered by other invisible stuff bouncing off the walls, right? maybe. which is why we all should go cable! i love analogue so much let me tell you how much i hate digital

if you for some reason just cant break 4444 out of jail and at least want to see if it will make a difference, sure thing, go to multiplayer options in-game and at the very bottom you could change the port to anything that around the range of 1024, for example 4455 (make sure that it is also a listening port, obviously) and make sure you also change it in the Launcher.cfg, found in the beammp launcher’s location. if you can join a server and the player count doesnt show a question mark, then everything went smoothly and hopefully now your experience will get less socket errors from now on

anyway, i hope i am leading you in the right direction. p2p, vpn, browsers, torrents, anything that uses internet - just turn that off.

take care <3

P.S.: guys if you are wondering about “failed to close socket” issues, then fear no more. check this out:

starting from version 2.1.0 such problems will be gone as they are moving from TCP to IPC, which is a UNIX socket!!! yay