Ever since I started playing 1.17 whenever I join my Realm I have about 10 minutes of playtime befor said error occures and the conncetion ends. Attempting to reconnect is meat with the error immediatly. Restarting my PC only gives me another 10 min until the next dissconnect.
Also there seems to be mutiple people having this issue on reddit, without a solution so far:
https://www.reddit.com/r/Minecraft/comments/nvdcxj/117_connection_reset_issues/
There also is an issue on this forum that has been shut down without answer:
If you consider this a technical issue I urge you to convert this ticket to the proper form instead of closing it.
Linked issues
Comments
Thank you for your report!
We're tracking this issue in MC-227913, so this ticket is being resolved and linked as a duplicate.
That ticket has already been resolved as invalid, which means this is a technical support issue. Please take a look at the parent ticket (MC-227913) and see if a solution is provided there.
If you need additional help to fix this problem, please contact Community Support and refer to this ticket (e.g. "I have reported this issue on Mojira as MC-XYZ.").
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

SocketException: Connection reset simply means that a TCP RST was received. TCP RST packet is that the remote side telling you the connection on which the previous TCP packet is sent is not recognized, maybe the connection has closed, maybe the port is not open, and something like these. A reset packet is simply one with no payload and with the RST bit set in the TCP header flags.
The following are possible causes for the error:
More commonly, it is caused by writing to a connection that the other end has already closed normally. In other words an application protocol error.
A Reset (RST) packet is received from a remote machine and interrupts the established connection. The sent RST packets may indicate that the TCP packets sent are not recognized, a connection between the local and remote machine is broken, or a particular port is closed and is not allowing for communication.
The TCP (Transmission Control Protocol) socket is closed because the socket received a close command from a remote machine.
The other end has deliberately reset the connection. It is rarely happens, and generally incorrect, for application software to do this, but it is not unknown for commercial software.
It can also be caused by closing a socket when there is unread data in the socket receive buffer.
Duplicate of MC-227913.