Open socket, wait in .lc file using LiveCode Server

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
aetaylorBUSBnWt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Thu Sep 20, 2012 5:11 pm

Open socket, wait in .lc file using LiveCode Server

Post by aetaylorBUSBnWt » Mon Feb 06, 2023 3:18 am

Hi,

I have Apache 2.4 configured to work on a macOS 10.12 Mac Mini.
I have Livecode Server 9.6.8 installed and running.
Some stuff works, some doesn't.
I am wondering if I am trying to do things that LiveCode does not support or requires something that I am not aware of.

I have a standalone LiveCode App that accesses a local sqlite database running on the Mac Mini. It talks to the world via sockets.
I have tested usage between machines where I have access to the router and can direct the port addresses to appropriate machines.
(no static IP addresses possible)
But I have a client where I can't get access to the router and direct socket communication to a particular machine.

So I figured I would use HTTP Get and Post communication.
I set up a .lc file on my Mac Mini that can receive commands from the outside world with the idea that it would open a socket to my standalone App (running on the same machine - it accepts socket connections) to handle the database operations and then send the results via the socket back to the .lc file which then sends back via HTTP back to the client.

The .lc file calls functions in a .livecodescript stack that is supposed to open a socket to the standalone app, forward the query to the standalone app, which then returns the results to the .lc file.

First: can I open a socket from a .lc file?
(I have tried it directly from the .lc file and from the .livecodescript stack)
What I see from the log files from the standalone app that Accepts Socket connections is a "client connection made" message, followed IMMEDIATELY by a "SocketClosed" message on the same port.

None of my "close socket" is getting executed (I removed it for now). So where is this "SocketClosed" directive coming from that tells the standalone app to close the socket?
Is there something in the httpd.conf file that restricts internal communications?

Second:

Does the "WAIT" command work in .lc files or in attached .livecodescript files running via LiveCode Server?

Is there a list somewhere of restrictions or differences between standalone apps and LiveCode Server?
(no such does NOT exist in the Dictionary! - if it does, please tell me where)

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”