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 / [BUG] IsNetworkActive and CloseNetwork, Tier 1

Author
Message
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 27th Nov 2017 11:53
Hello peeps I have encountered a small bug (I think). If I use IsNetworkActive() to check if the network is active, it will return 1 if it is still trying to connect but that I can around by using GetNetworkMyClientID() as that will return 0 until it connects. I try to close the network using CloseNetwork(), but this will crash the app (Windows 10, have not tried it anywhere else) if the network never connected to host. It seems that I can work around this by using GetNetworkMyClientID() (as it will become 0 if the network disconnects).

13/0
Dybing
13
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 27th Nov 2017 21:44
Is this on server or on client?

If on server, it'll work fine - if on client, it won't. To disconnect a client from a network, you need a bit different code. Actually, you need to send a disconnect request to server, then have server kick the client. and then listen for the client disconnect. It's a bit convoluted.
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 28th Nov 2017 10:04
It is client side. But I got a workaround with GetNetworkMyClientID() as this will return zero when not connected yet or when disconnected.

The server handles disconnection really fine, if I just close the client with no disconnect request, the server still disconnects the client
13/0
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 28th Nov 2017 16:16
IsNetworkActive will return 1 even if the network is still in the process of connecting, however it shouldn't crash when you call CloseNetwork during this process. Fixed for the next version.

Login to post a reply

Server time is: 2024-11-24 06:51:40
Your offset time is: 2024-11-24 06:51:40