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 / HostNetwork() example not working with more than 1 device

Author
Message
Jo Bach
9
Years of Service
User Offline
Joined: 22nd Dec 2014
Location:
Posted: 1st Feb 2015 00:14
Hello,

The example on the help site (press F1 with HostNetwork()) runs oke.

I copied the exe + media folder to a new folder (PC is called Host).

In the first line I changed Host to Host2 so to get an new user, compile it and use "broadcast" on my android machine (it is called host2), if i am doing this right>?

PC version: networkId = HostNetwork("ExampleNetwork", "Host", 1025)
android version: networkId = HostNetwork("ExampleNetwork", "Host2", 1025)

I still getting numbers of clients=1
The names are different (pc=host and android=host2) as above, but there is with both still the message "client is HOST".

What should i do to get at least the connection working?

I can't go on when this is not working properly.

Windows asks my fire wall to accept. I did that, so did it accepting it for AVG.

The android machine doesn't ask anything.

Need help. Thank you.
ALeN
10
Years of Service
User Offline
Joined: 7th May 2014
Location: Bosnia and Herzegovina
Posted: 1st Feb 2015 06:25 Edited at: 1st Feb 2015 06:56
Try this:

PC version: networkId = HostNetwork("ExampleNetwork", "Host", 1025)
android version: networkId = HostNetwork("ExampleNetwork2", "Host2", 1025)

First one is network id ("ExampleNetwork" and "ExampleNetwork2" in this case). The second one is player name("Host" and "Host2" in your example) and the last one is the port. You can use the same name for player but you must have different network id (network name).

HostNetwork( "NetworkName", "PlayerName", Port )

This is if you want 2 different network, one for pc and one for android, so you can play on one network between two or more pcs and on another network between two or more android devices. But I guess you want connect pc and android device on the same network. Then you must use command JoinNetwork and write like this:

pc version: HostNetwork( "NetworkName", "PlayerName", Port )
android version: JoinNetwork( "NetworkName", "PlayerName" )

But if you do like this then you can host game only on pc and join only from android. If you want to make game that you can host and join between two same devices (only 1 version of the game) let me know and I will try explain how to do that.

Here is multiplayer game example from agk documentation:
http://www.appgamekit.com/documentation/examples/multiplayer/0_getting_started.htm
Jo Bach
9
Years of Service
User Offline
Joined: 22nd Dec 2014
Location:
Posted: 1st Feb 2015 20:18
Hi AleN,

Thanks for your help. Yes it has to be done with one network.

The help-function info of HostNetwork() doesn't tell that I should leave the Prot number.

I use the PC becouse I have one tablet.

For example:

I have a Tablet (A) and I want to send a txt-message over a network to an other family member in another city for example, who has also a tablet(B), then I have to set :

(A) HostNetwork( "NetworkName", "PlayerNameA" )
(B) HostNetwork( "NetworkName", "PlayerNameB" )

Is there no port needed?

I will go and try the example you send, and let you know if I was able to fix it.

Greetings

Jo Bach
9
Years of Service
User Offline
Joined: 22nd Dec 2014
Location:
Posted: 1st Feb 2015 23:07
Hi AleN,

I saved a second project with JoinNetwork() instead of HostNetwork() and it works fine now.

Thanks.

Now I can go on.

LOL

ALeN
10
Years of Service
User Offline
Joined: 7th May 2014
Location: Bosnia and Herzegovina
Posted: 2nd Feb 2015 06:23
Glad to hear that you succeed. And one thing from your previous post about port. If you host network you need port and if you join network you don't need port in your code, you need only network name and player name when you join network.

Good luck

Login to post a reply

Server time is: 2024-05-19 03:43:52
Your offset time is: 2024-05-19 03:43:52