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] Networking :Texting

Author
Message
ruckertheron
7
Years of Service
User Offline
Joined: 12th Nov 2016
Location:
Posted: 18th Jan 2019 14:14 Edited at: 18th Jan 2019 14:16
I am trying to create a texting program. The concept is to host a network on a laptop and then use two phones to connect to that host to send each other messages.

First thing I did was code the host program. It only outputs the names of any client connecting to it.

Second thing I did was code the client program. It joins the network by name, names the client and prints it at the top of the screen, gives you a list of messages that were sent on the network by all clients, and gives you an input box to type messages to send to the host network. I named this 'client1'. I proceeded to copy this code with a new project that I
named 'client2'.


I run the host program 1st, client1 2nd, and then client2 3rd. I look on the host and it says host,client1,client2. I'm able to send messages and have a conversation via text messaging.

When I export the client1 project to .apk, it doesn't connect by the network name on the phone. (Droid - samsung j3 achieve) So I changed the code to join the host via IP. I even used GetDeviceIP() function to return the IP of the laptop and hard coded it in the JoinNetwork() function using port 1025. Still won't connect? What could be the problem?




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

Go to answer

PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 19th Jan 2019 14:03 Edited at: 19th Jan 2019 14:18
I've got no multiplayer experience with AGK2 yet, so take this with a grain of salt, but I think I remember something about AGK2 on mobile not easily communicating with apps that aren't 'the same apps'?
As in, a multiplayer game would have the server code run on a separate server as a host, however simultaneously the very same app would control the clients? I can see how that could result in certain vulnerabilities perhaps with a completely separate server / host app making more sense. Maybe it is something like that? ie. unrelated to the code that appears to be working?

I'm assuming the first test you did was using 3 computers, no mobile phones? Did you try testing using both Run from the IDE for a client and Broadcast from the IDE simultaneously with the 'server app' already running from an .exe?

When it comes to connections it may be something related to permissions, network security settings on the smartphones or maybe the IP addresses you use (I mean IP vs IPv6 )?

By the way, did you try port 1026 instead of 1025? I remember one of the Guides mention IPv4 needs a port set to something between 1026 and 65535 , not 1025 ? (note, the manual example does suggests 1025 as an option, but the manual reads: "The port value must be between 1025 and 65535, and will fail if another application is already listening on that port." .)
ruckertheron
7
Years of Service
User Offline
Joined: 12th Nov 2016
Location:
Posted: 21st Jan 2019 15:24
Well I tried he 1026 port and to no avail... I actually just used the same laptop for host, client1, client2. Now I used two laptops and they cant connect via the Network Name.. I would make the first client on the network as a host but I don't know how to read if a network exists and if it doesn't then become a host from a client app... do I have to listen? Kind of confused about the listener
MillaSays
6
Years of Service
User Offline
Joined: 15th Dec 2017
Location:
Posted: 22nd Jan 2019 12:10 Edited at: 22nd Jan 2019 12:10
This post has been marked by the post author as the answer.
I do it like this for the (LAN) multiplayer part of a game:

1: Client ask server hosted on AWS for IP to MP host that is on LAN (over https)
2: Client receive LAN host over IP given from server on port 1025
3: LAN host displays name of client
4: LAN host starts game when whoever controls feel like it

Mind you, this is based upon 'groups' where a group have exactly one LAN host allowed to be active (ie reporting in to my AWS server) at a time - each client need have permission for that group - and the media that belongs to that group already downloaded before being allowed to join. Media is synced between our server, the LAN host and the clients upon startup.

For server, AppGameKit won't do for a few reasons - chief amongst them AppGameKit apps do not run in headless mode (no graphic calls, text only in console/terminal). And second, performance. I could add third lack of more advanced hosting commands. For LAN hosting though, AppGameKit is fine. I've limited each LAN game to max 30 clients - which by no coincidence is also the max number of students in a primary school class.

Login to post a reply

Server time is: 2024-04-20 07:11:09
Your offset time is: 2024-04-20 07:11:09