Page 1 of 1
Building FTP Server
Posted: Sun Jan 27, 2013 5:30 am
by Nakia
Hi,
Not sure of the complexity of this task but would it be hard to build a simple FTP Server?
Doesn't need all the bells and whistles but just need control over it more so than what I can achieve from other products out there right now.
Have successfully used sockets before in a TCP Telnet Client application but to be honest not sure where to start with a FTP Server (if its at all possible)
Am I biting off more than I can chew with this?
- Things to note:
1. User will need to select base directory before starting the server
2.Server will communicated to from iOS Only and the Server will need to publish itself on the Bonjour service (think I can manage the Bonjour registration and publication part)
3. Server will only ever be receiving plain text files.
Re: Building FTP Server
Posted: Sun Jan 27, 2013 7:29 am
by FourthWorld
You could write it, but it would be a bit of work and you'd still be dealing with the downsides of FTP. Do you need some specific aspect of FTP which would prevent you from using a simple CGI over http? An HTTP version would be easier to build for medium-to-small files, and likely much faster.
Re: Building FTP Server
Posted: Sun Jan 27, 2013 8:56 am
by Nakia
FourthWorld wrote:You could write it, but it would be a bit of work and you'd still be dealing with the downsides of FTP. Do you need some specific aspect of FTP which would prevent you from using a simple CGI over http? An HTTP version would be easier to build for medium-to-small files, and likely much faster.
Hmmm, well there is no reason it cant be HTTP thinking about it.
Things it needs to do follows:
1 - Be able to receive small text files
2 - Base directory set before the "Service" starts
3 - Be fool proof, no playing with firewalls and the likes
Re: Building FTP Server
Posted: Sun Jan 27, 2013 9:48 am
by FourthWorld
1. Easy
2. Not sure what that means
3. Firewalls vary so much that no truly foolproof design is possible. That said, you're likely to encounter far fewer problems with HTTP than you would with FTP.
Re: Building FTP Server
Posted: Sun Jan 27, 2013 10:11 am
by Nakia
Any examples around the place that you know of?
Re: Building FTP Server
Posted: Sun Jan 27, 2013 10:17 am
by FourthWorld
There's not much to it: on the client side use the POST command, and on the server get the data from the $GET_POST array. Much easier than writing an FTP server.
This Lesson may help:
http://lessons.runrev.com/s/lessons/m/4 ... ode-server
Here are more on working with RevServer:
http://lessons.runrev.com/s/lessons/m/4070
Re: Building FTP Server
Posted: Sun Jan 27, 2013 10:25 am
by Nakia
Okay,
Looks like its just for LC Server though or am I miss reading the Dictionary?
"$_GET is only available when running in CGI mode (Server)."
FYI, this won't be running on a server but as an application..
Re: Building FTP Server
Posted: Sun Jan 27, 2013 4:00 pm
by sturgis
You might look here:
http://andregarzia.com/page/revonrockets If a single threaded implementation of a web server in lc will work, then you can learn LOTS from this. It accepts both post and get, can also be adjusted to run specific commands on receipt of data (have only done this with get, it probably works with post too). As it says on the front page, it is NOT a replacement for apache. If you don't need multiple threads, multiple users though, it works really well. I was using it for a while as the receiving end for a remote control app. (android, remote mouse moves and clicks, though the click part requires an external since lc can't click outside its own app windows by default)
Since you already have socket experience, it would be a great stack to learn from if nothing else. Haven't tested with IOS, but android can post and get to it just fine.
EDIT: If you DO need a more heavy duty receiving end, there are enough point and click web servers that can be set up with little knowledge, you can go that direction instead. (and maybe use php as the back end if you don't have a license to lc server)
Re: Building FTP Server
Posted: Sun Jan 27, 2013 10:02 pm
by Nakia
Thanks Sturgis,
I have actually been thinking that maybe I could just the rresockets external (for iOS) and simply devise up my own transfer method.
Seeing as though I am only wanting to transfer small text files this should work shouldn't it?
Just looking at that HTTP Server it seems very over kill for what I need to achieve, single user, small files, basic callbacks etc etc.
Re: Building FTP Server
Posted: Sun Jan 27, 2013 10:24 pm
by jacque
This may be what you want:
http://www.hyperactivesw.com/cgitutorial/index.html
You'll need an older version of the LiveCode engine, plain-text CGIs don't work with the current release.
Re: Building FTP Server
Posted: Sun Jan 27, 2013 11:06 pm
by Nakia
Thanks Jacque,
Looking at this though I am still convinced it is just too complex for that I need to achieve.
I think I am going to look at the sockets route for now, and just move the data over some sockets.
Note - This is for a Mobile to Desktop application where the Application needs to write and get txt files <1Mb a few times a day.
I am currently using FTP to do this and it works fine but that relies on having the FTP Server running (and setup correctly, firewalls etc) on the Desktop and this is the problem a few of my users are having..
If it i use sockets in my own desktop application (for Mac and Windows) then I figure I have complete control and can make it much simpler for the user.