iOS socket connection not working

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Aduro91
Posts: 36
Joined: Sat Jul 22, 2023 8:49 pm

iOS socket connection not working

Post by Aduro91 » Tue Sep 19, 2023 9:58 pm

Hey all,

I can't seem to get a socket connection working between the app running on my iPhone and it running on livecode on the desktop.

I have simply copied the scripts/objects for the client and server side from the following downloadable livecode examples: https://sites.google.com/a/pgcps.org/li ... uter-games


I've tried my iPhone as the server and desktop as client, and vice versa. When I try to connect to the server started on my desktop from my iPhone the app will just close down. And a server address doesn't appear using the following code on the iPhone like it will when running on desktop:

put the hostNameToAddress of the hostName into theAddr
set the itemDelimiter to return
put (item 1 of theAddr) & ":9001" into the field "serverAddr"

Any help would be much appreciated!

Aduro91
Posts: 36
Joined: Sat Jul 22, 2023 8:49 pm

Re: iOS socket connection not working

Post by Aduro91 » Wed Sep 20, 2023 7:28 pm

I'm so lost with this stuff, is it possible to achieve basic sending and recieving information online (not local network) between iOS and other devices with Livecode? If someone could at least confirm or deny this I can know whether to give up or not

SparkOut
Posts: 2857
Joined: Sun Sep 23, 2007 4:58 pm

Re: iOS socket connection not working

Post by SparkOut » Wed Sep 20, 2023 7:41 pm

1) your standalone settings will need to include the correct elements (internet, etc) to be ticked in the Invlusions tab
2) if you are trying to traverse the internet connectikn, you will need to be using thd public IP for the server (the touter's WAN IP address, and have port forwarding set on the router to deliver the right packets to the right destination for the server's internal address
2a) consider security and ensure appropriate restrictions for source, ports, protocols, etc are applied
2b) consider IOS client posting data to https server you host, which is coded to respond appropriately, instead of trying to invent a new socket protocol with inherent complecity and vulnerabilities.

Aduro91
Posts: 36
Joined: Sat Jul 22, 2023 8:49 pm

Re: iOS socket connection not working

Post by Aduro91 » Wed Sep 20, 2023 8:38 pm

SparkOut wrote:
Wed Sep 20, 2023 7:41 pm
1) your standalone settings will need to include the correct elements (internet, etc) to be ticked in the Invlusions tab
2) if you are trying to traverse the internet connectikn, you will need to be using thd public IP for the server (the touter's WAN IP address, and have port forwarding set on the router to deliver the right packets to the right destination for the server's internal address
2a) consider security and ensure appropriate restrictions for source, ports, protocols, etc are applied
2b) consider IOS client posting data to https server you host, which is coded to respond appropriately, instead of trying to invent a new socket protocol with inherent complecity and vulnerabilities.
Thanks for the response!

I have internet ticked in inclusions and to be honest I'm not sure what other inclusions I need, but I selected everthing that looks vaguely related.

To be honest most of this is going over my head, perhaps the best chance is the last one: posting data to an https server I host. However, I'm also in over my head currently in this area. I'm guessing it would cost me to run this server? And this process would involve tonnes of coding I wouldn't know where to start with.

If there was some kind of clear precedent for this on LiveCode, maybe an example stack or demo server I could try out with I would eventually invest in this, but it feels strangely without any guides or supporting documents.

I just need simple messages to be sent between devices using the app to perform online multiplayer in my app. I've managed to get it vaguely sketchily working through a LiveCloud database, a free LC-associated database server platform where the app updates fields and reads the fields for the other player and acts accordingly. It's just that it doesn't seem to be smoothly working, might be able to work with it, but its a bit frustrating that I have to use such strange workarounds when using LiveCode when in other languages and software I could just use GameCenter for multiplayer (I tried MergGK and it can only send and recieve multiplayer data through local network and even that didn't seem to work)

Post Reply

Return to “Talking LiveCode”