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 / Setting up a Global Network

Author
Message
badkneecap
14
Years of Service
User Offline
Joined: 21st Jun 2010
Location:
Posted: 23rd Dec 2011 01:36
So, I was able to create a server app on my computer that stores high scores. My AppGameKit game submits high scores to it locally and it works. Here's how I create the network locally in the server app:

iNetID = HostNetwork("myNetwork", "Server", 4100)
do
...
loop

And my game app does this:

Function SubmitScore()
iNetID = JoinNetwork("myNetwork", "Client"+str(Random()))
...
EndFunction

I now want to make it so my phone can submit the scores to my server app. I checked my computer IP address (let's say it's 55.55.55.55). I went to my router and forwarded port 4100 to my computer (192.168.1.123).

My server app now looks like this:

iNetID = HostNetwork("55.55.55.55", "Server", 4100)
do
...
loop

And:

Function SubmitScore()
iNetID = JoinNetwork("55.55.55.55", 4100, "Client"+str(Random()))
...
EndFunction

Doesn't see the submitted score. Has anyone else done this? Is there something simple I'm doing wrong? Is there an easy way to test if port 4100 is forwarding to my App?
LittlePIC
13
Years of Service
User Offline
Joined: 19th Oct 2011
Location:
Posted: 23rd Dec 2011 02:23
Have you unblocked port 4100 at the router?

Drop any firewall's etc to see if this is your problem
badkneecap
14
Years of Service
User Offline
Joined: 21st Jun 2010
Location:
Posted: 23rd Dec 2011 04:49
I checked my router and it's not blocking those ports. I checked my firewall and I can see an event trigger for it, but still no luck.
badkneecap
14
Years of Service
User Offline
Joined: 21st Jun 2010
Location:
Posted: 23rd Dec 2011 18:53
I have an update. Unfortunately, I'm even more confused. The server all is configured as I describe above. I created a test application as I did above and it works. I put the code in a loop and it submits high scores every 5 seconds.

I then installed it on my Android phone and turned off Wi-Fi on my phone. And it worked! So, I thought I was home free.

I then added the function to my game. I copied the exact same function (which generated random high scores and submits) but it just does not connect. Exact same function code. One works and the other doesn't. Is there setting in my game that might prevent it from connecting like my sample app?

Here's the function I wrote to test:



In my game, I simply called the function to submit a random hight score, but it just does not want to connect. Does anyone have any idea why one app wound work and the other not? I'm running them both locally on my computer.
badkneecap
14
Years of Service
User Offline
Joined: 21st Jun 2010
Location:
Posted: 24th Dec 2011 15:46
Another update. I took the function to submit the high score and moved it directly into my code and it worked. So, this fixed my problem, but it makes me wonder why.

So, this is what I had that doesn't work:



When run like this, it doesn't work. If I move the code in "Function SubmitScore()" directly into "function1()", it works.

Has anyone else come across anything like this?
LittlePIC
13
Years of Service
User Offline
Joined: 19th Oct 2011
Location:
Posted: 26th Dec 2011 01:12
That is very odd? and not come across anything like that?!

You are forced to call the function from within a function to male it work?

Good thinking outside the box to even try this approach. Will keep this 'chestnut' as a short term work around.

Nice fine and not giving up
badkneecap
14
Years of Service
User Offline
Joined: 21st Jun 2010
Location:
Posted: 26th Dec 2011 20:13
Actually, it's just the opposite. I had a function call another function and it was not working. So, I took it out of the second function and put it directly into my code and it worked.

AGK, any ideas why it would not work when a function called another function?
badkneecap
14
Years of Service
User Offline
Joined: 21st Jun 2010
Location:
Posted: 27th Dec 2011 22:02
I feel like an idiot! This was bothering me, so I kept debugging and I found the problem. I created a file to hold my new function but renamed it. I was including the original file that did nothing, so that's what I got... nothing. Problem solved. Hope others might learn from this rookie mistake!

Login to post a reply

Server time is: 2024-11-22 20:50:09
Your offset time is: 2024-11-22 20:50:09