Valheim – Server Fix for Socket Disposed ZRpc People Unable to Connect – Works with 0.150.3

Valheim – Server Fix for Socket Disposed ZRpc People Unable to Connect – Works with 0.150.3 1 - steamlists.com
Valheim – Server Fix for Socket Disposed ZRpc People Unable to Connect – Works with 0.150.3 1 - steamlists.com

This is a guide to fix an error experienced by someone connecting to your server.
The might get to the password screen, or even hear some sound effects and then get disconnected, this should fix it, and works for me. Hopefully it will help others out there.

Fixes Disposing Socket error, and ZRpc Disconnect error (these were the error codes that my server’s console was throwing up when people were getting disconnected during login).

 

Info

I have had an issue where one of my friend’s was unable to join the server a couple of updates ago, and I found a fix for it that worked for the old version, and also the latest patch (0.150.3).

* WARNING *
Please don’t hold me responsible if this bricks your world. I have been backing my world and character up after each play session to make sure, and haven’t run into any snags so far using this method.

Backup your Files

Step by Step Backup and Restore

Use step 6 only if you want to restore unedited .dll

[1] Find “assembly_valheim.dll” in”X:\SteamLibrary\steamapps\common\Valheim\valheim_Data\Managed\”
(Where X:\ is your drive for the steam game)
[2] Copy your current assembly_valheim.dll
[3] Paste it in the same place
[4] Rename the new file as assembly_valheim.dll.bak
[5] Proceed with Guide – Section – Modding the File (See below to restore original file)
[6] (To restore) assembly_valheim.dll.bak
[7] Delete assembly_valheim.dll
[8] Rename assembly_valheim.dll.bak => assembly_valheim.dll

Modding the File

Step by Step Instructions (dnSpy)

Disclaimers: All links go to either steam or github.

Don’t do this if you haven’t done the above guide to step 5.

These instructions are only for dnSpy which I used and saw working for windows server 2019 and windows 10 (client) both running Valheim 0.145.6.

(MONKEYTOMMO’s NOTE – Working for me on Windows 10 x64 – 0.150.3)

Clientside may also need to share/edit the same assembly file if server’s fix is not enough for your session, I noticed in-game F2 shows data cap at “60kb/s” at sending (from client) post-edit but receiving (to client) is bound by new cap which means this edit should be working.

(MONKEYTOMMO’s NOTE – My friend hasn’t had to edit any files, the server side edit seems to fix it for him, and besides, I wouldn’t recommend doing this because we don’t know if it may trigger a VAC ban).

[1]Download dnSpy (github)
[2]Unzip into a dnSpy folder
[3]run dnSpy.exe
[4]File > Open
[5]Find “assembly_valheim.dll” in”X:\SteamLibrary\steamapps\common\Valheim\valheim_Data\Managed\”
(Where X:\ is your drive for the steam game)
[6]Select assembly_valheim.dll to open
[7]In the search box at the bottom (can click the magnifier glass symbol) type m_timeout
[8]Double click the entry that says m_timeout on the left, and on the right ZRpc
[9]The next screen will show code with a line that says ‘private static float m_timeout = 30f;
[10]You need to change 30f to 300f as Johan Sandström suggested in his post on the bug tracking site. To do this right click m_timeout and select ‘Edit Class (C#)…’
[11]Now you can change 30f; to 300f; – Now you need to click ‘COMPILE’ which is in the lower right corner.
[12]Click “File > Save Module”
[13]Click “OK” without modifying default checklists.

Deliver this new assembly_valheim.dll to your server, overwriting it in the same location.(Make sure you saved and it’s offline before overwriting it)
(If you made a mistake or things aren’t working revert to your assembly_valheim.dll.bak)

If the game updates this .dll may need to be re-edited in the same way.

PS. Also make sure your server can send/upload to new bandwidth cap set.

(MONKEYTOMMO’s NOTE – I do this on a dedicated server I run on my PC as I play the game, I noticed the old guide also seemed to work on paid hosting, which I haven’t been able to test myself. I hope this helps some people out there 😀 )

Final Message

I really hope this can help some people out there, and thanks to the original people for their ideas. My buddies and I were enjoying the game together before the last couple of updates without issues, and now this method of editing the file seems to be the only way we can play the game online together.

Anyway, back up your files, and have fun!

Written by Dæmon

I hope you enjoy the Guide we share about Valheim – Server Fix for Socket Disposed ZRpc People Unable to Connect – Works with 0.150.3; if you think we forget to add or we should add more information, please let us know via commenting below! See you soon!


2 Comments

  1. Tested in Valheim 0.153.2 For an International Server (MEX to CAN)
    Using a CABLE CONN (30Mbps) with severe “Disconnect” issues.

Leave a Reply

Your email address will not be published.


*