Simple app communication with server
Posted: Fri Jun 27, 2014 6:38 pm
I want to run a LC server stack that accepts data from an app I have written.
I have a single card with a field named "holding" to save the incoming data. I will do some processing of this data ie email it to 2 email addresses in the data and to myself.
The code for the card (so far) is:
on openCard
accept connections on port 2082 with message "clientConnected" -- port 2082 is TCP port
end openCard
on clientConnected pSocket
read from socket pSocket until cr with message "messageReceived"
end clientConnected
on messageReceived
put it into fld "holding"
end messageReceived
The data I expect will be comma separated variables (about 10) and can have different numbers of characters but will always end with a cr.
Nothing on my site is visible. It is only used for this single purpose at this point.
I have three questions.
1. How can I reject incoming data from unwanted sources?
2. Should I set the maximum number of characters I expect?
3. I assume LC Server needs to be resident on the site but I am not quite sure do I want to run in the command line mode or CGI mode?
I lied there are 4 questions
4. Is it possible to save this stack as a standalone and run it on the server?
I am sure I'll have more questions but I think these will give me a good start.
I hope I'm at least on the right track
Thanks for the help.
Tom
I have a single card with a field named "holding" to save the incoming data. I will do some processing of this data ie email it to 2 email addresses in the data and to myself.
The code for the card (so far) is:
on openCard
accept connections on port 2082 with message "clientConnected" -- port 2082 is TCP port
end openCard
on clientConnected pSocket
read from socket pSocket until cr with message "messageReceived"
end clientConnected
on messageReceived
put it into fld "holding"
end messageReceived
The data I expect will be comma separated variables (about 10) and can have different numbers of characters but will always end with a cr.
Nothing on my site is visible. It is only used for this single purpose at this point.
I have three questions.
1. How can I reject incoming data from unwanted sources?
2. Should I set the maximum number of characters I expect?
3. I assume LC Server needs to be resident on the site but I am not quite sure do I want to run in the command line mode or CGI mode?
I lied there are 4 questions
4. Is it possible to save this stack as a standalone and run it on the server?
I am sure I'll have more questions but I think these will give me a good start.
I hope I'm at least on the right track
Thanks for the help.
Tom