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 Classic Chat / [SOLVED] GetSocketConnected does not update to -1 if the server closes, or the connection is broken ...

Author
Message
Abiz
11
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Amsterdam
Posted: 1st Oct 2020 15:16
I couldn't post to this thread, so I opened a new one.
Yes, I did read this: https://forum.thegamecreators.com/thread/223242

However, this answer confuses me, and I would like to understand it better:
Quote: "This is how it should work. Quite annoying, I know, but no bug.
You need to send some cylic ping in order to see if the socket server is closed, or you send something to the server, if there is no tcp response, no message arrived and the server is seen as closed.

If you use the network command set (that also uses tcp sockets), it's already integrated."


As far as I know and have been able to determine, the network command set that AppGameKit uses ONLY works when all parties are on the SAME network.
I want to use sockets for global connections, and unless I'm missing something, I can only do that with sockets and the socket commands.
Mobile devices on a mobile network are not on the same network and therefore the network commands won't work (since there is no broadcaster, I believe)/

I would love to be wrong, but I need answers. The examples for Socket server/client in AppGameKit are hard hard hard to find.
Thanks,
James

The author of this post has marked a post as an answer.

Go to answer

Abiz
11
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Amsterdam
Posted: 1st Oct 2020 17:21
Additional tests show that where using UDP listeners & SendUDPMessage work without a problem.

Neither SOCKETS or AppGameKit Networking examples work.
We are testing on 2 computers, one in the USA and one in Europe.

The issue is that UDP can (and has) lost packets, and we need to change that to TCP to make sure packets cannot get lost or be out of order.

Appreciate any and all help.
James
Abiz
11
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Amsterdam
Posted: 1st Oct 2020 17:48
Here are the code examples (Taken straight from the Kevin Summers example)

Server side:


Client side:


smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 2nd Oct 2020 03:58
I had issues with sockets and multiplayer command bypassed it all with a heartbeat. Server send heartbeat to client and client send heartbeat to server. More then sux seconds with no heartbeat server deleted socket and removes player.

Abiz
11
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Amsterdam
Posted: 2nd Oct 2020 14:43
Sounds good but I don't even get these to connect.
The only thing that works out of the box was UDP, I just can't get it to connect over the atlantic

Could you share your basic solution, or even a simple framework example?

Thanks,
James
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 3rd Oct 2020 01:30
This post has been marked by the post author as the answer.
Well i was actually in the process of rewriting this to simplify it using array indexing so atm might be a bit confusing the way i handle connects and disconnects. was basically a rough draft of the sever side code.








Abiz
11
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Amsterdam
Posted: 3rd Oct 2020 14:04
Quote: "Well i was actually in the process of rewriting this to simplify it using array indexing so atm might be a bit confusing the way i handle connects and disconnects. was basically a rough draft of the sever side code."

Much appreciated, I will start working on this immediately.
Have a great day!
James
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 3rd Oct 2020 16:25
Figured i could give you all the complete code. The the code i gave yesterday was just for the login server. Servers connect to it an clients before it hands clients off to another server. Below login server server and some client code and a template i found may have been a rewrite.

Login to post a reply

Server time is: 2024-04-25 00:59:32
Your offset time is: 2024-04-25 00:59:32