Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reported issue: Hosted games suddenly stop responding / lose connection #443

Open
GrantBartlett opened this issue Jan 29, 2025 · 3 comments

Comments

@GrantBartlett
Copy link
Member

GrantBartlett commented Jan 29, 2025

User reported issue. Client log attached.

Another thing I seem to be online, but in fact apparently the connection is lost. Players are still displayed and in my room the players are also displayed. The room does not close.
And now I am still "online"

Image

Image

Image

client.log

@GrantBartlett
Copy link
Member Author

Key bits from the log look like:

25.01. 19:40:27.398    Parsing tunnel information failed: System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at DTAClient.Domain.Multiplayer.CnCNet.CnCNetTunnel.Parse(String str) in C:\Dev\xna-cncnet-client\DXMainClient\Domain\Multiplayer\CnCNet\CnCNetTunnel.cs:line 39

Then

25.01. 19:41:32.410    SRM: PING LAG978361
25.01. 19:41:32.430    Sending message to the server failed! Reason: System.IO.IOException: Unable to write data to the transport connection: Удаленный хост принудительно разорвал существующее подключение. ---> System.Net.Sockets.SocketException: Удаленный хост принудительно разорвал существующее подключение
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at DTAClient.Online.Connection.SendMessage(String message) in C:\Dev\xna-cncnet-client\DXMainClient\Online\Connection.cs:line 970
25.01. 19:41:37.630    Discord: Pipe Connection Failed. Could not connect to pipe #-1
25.01. 19:41:46.340    SRM: NOTICE #cncnet-yr-game3712314 :�TNLPNG 249�
25.01. 19:41:46.341    Sending message to the server failed! Reason: System.IO.IOException: Unable to write data to the transport connection: Удаленный хост принудительно разорвал существующее подключение. ---> System.Net.Sockets.SocketException: Удаленный хост принудительно разорвал существующее подключение
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at DTAClient.Online.Connection.SendMessage(String message) in C:\Dev\xna-cncnet-client\DXMainClient\Online\Connection.cs:line 970
25.01. 19:41:51.134    SRM: NOTICE #cncnet-yr-games :�GAME R12;8.67.3;8;#cncnet-yr-game3712314;O C E A N I A - 2 2 2 2;10000;CCCP84,firesoul,EPS,YYxxxYY,YXL,Magis;[8] Oceania (Author's Mod);Mod Maps;18.139.238.16:50000;0;0�
25.01. 19:41:51.134    Sending message to the server failed! Reason: System.IO.IOException: Unable to write data to the transport connection: Удаленный хост принудительно разорвал существующее подключение. ---> System.Net.Sockets.SocketException: Удаленный хост принудительно разорвал существующее подключение
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at DTAClient.Online.Connection.SendMessage(String message) in C:\Dev\xna-cncnet-client\DXMainClient\Online\Connection.cs:line 970
25.01. 19:42:02.413    SRM: PING LAG761844
25.01. 19:42:02.413    Sending message to the server failed! Reason: System.IO.IOException: Unable to write data to the transport connection: Удаленный хост принудительно разорвал существующее подключение. ---> System.Net.Sockets.SocketException: Удаленный хост принудительно разорвал существующее подключение
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at DTAClient.Online.Connection.SendMessage(String message) in C:\Dev\xna-cncnet-client\DXMainClient\Online\Connection.cs:line 970

Seems to lose connection but doesn't inform the user?

@CCCP84
Copy link
Contributor

CCCP84 commented Jan 29, 2025

Image

client.log

@11EJDE11
Copy link

Maybe this in Connection.cs?

            if (!serverStream.DataAvailable)
            {
                Thread.Sleep(10);
                continue;
            }

DataAvailable is false even when disconnected so it's never getting to the error code. Remove that code block and you will correctly get the disconnect message and it will reconnect if you plug the cable in again quickly. Seems in line with what used to happen, too.

In the same file I also I wonder about:
if (serverStream.CanWrite)
{
try
{
serverStream.Write(buffer, 0, buffer.Length);
serverStream.Flush();
....

I don't think it causes any problems, but MS say:
The CanWrite property is set when the NetworkStream is initialized. Changes in the underlying Socket's state (eg. closure) do not affect the value of CanWrite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants