Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Network connection dies after some hours

Author
Message
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 13th Jun 2024 11:12 Edited at: 13th Jun 2024 11:40
Hi I'm making an C++ console app that acts as a host running on a Ubuntu server. It seems like the connection dies after some hours but the app is still running. I have made a small helper app that simply replies to a "keep connection alive" message, but the connection still dies after some hours. The app is supposed to be a dedicated server app that should be running indefinitely. I don't know what to try next, so I was hoping someone could shed some light on this issue. I am using the regular Multiplayer commands, not Socket or UDP commands.

EDIT: I'm making a small app that uses sockets instead to see if the connection can stay alive that way.
13/0
Scribble
7
Years of Service
User Offline
Joined: 2nd Apr 2017
Location:
Posted: 14th Jun 2024 03:24 Edited at: 15th Jun 2024 02:23
Hello Cybermind.
I had this problem when using Multiplayer commands in my last online multiplayer game too.
The server app (made in AppGameKit Studio Tier 1) seems to stop responding to connection after 3 days. Need to be restarted.
But after a couple of weeks, the server app seems to be able to function for 2 weeks before it stopped responding to messages, and need to be restarted. I didn't do anything, it just improves on it's own.
The server was hosted in Amazon AWS, using some sort of Windows virtual machine I think.
Aside from using Multiplayer commands, it also uses File OpenToWrite() commands.

I think, there are 3 possibilities regarding the source of the problem, but I cannot confirm them:
1) Amazon AWS is doing some backend restarting on their server or something similar
2) There's a bug in my server app, where if a client is sending a near-empty/very small file size (1-3 bytes?), the server will OpenToWrite() and never CloseFile(), due to my incorrect programming. This probably introduced some kind of bloat, and make AppGameKit server app stop working correctly after a certain threshold. AppGameKit apps will throw some weird unnamed error if it deals with RAM problem, whether it normal RAM or VRAM, you can't always see what it is. The app will still run, but they'd not function correctly anymore.
3) Another one of many AppGameKit hidden internal bug.

Not sure if the above is relevant to your case.
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 17th Jun 2024 04:27
Keeping a connection alive for extended durations can be a challenge, due in no small part to the way network connections, routers, and software behave outside of anything you code. Things can close down any time for any (sometimes unknown) reason. #1 on Scribble's list is a likely culprit on that side of things. Expect intermittent disconnects every 24-48 hours and design your system accordingly. You may want to include an automatic restart of your server app/program once a day and/or perhaps after a length of time with no signal or response as expected. It's pretty easy to do with the RunApp() command, just launch again and end the old running task. For server apps, you may want to include yours in the startup of the system it's running on so it activates any time the host machine might restart for any reason (updates, power outages, system upgrades, etc, etc, etc).

Taking these precautions will also help minimize any other potential problems that might surface due to quirky memory behaviors, system instabilities, or other unexpected events.
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 17th Jun 2024 10:12
Thank you for your insights guys I had the socket connection running for 1.8 days before it went stale but I can still make new connections to the server using sockets, which in my case is fine. The problem with the regular multiplayer commands was that I was not able to make new connections after a day or two. As long as the player can have a session for as long as 1.8 days I think it'll be fine
13/0

Login to post a reply

Server time is: 2024-06-21 21:36:19
Your offset time is: 2024-06-21 21:36:19