Click here to Skip to main content
15,891,033 members
Articles / Mobile Apps
Article

FTP Server for XP Embedded

Rate me:
Please Sign up or sign in to vote.
4.33/5 (5 votes)
3 Aug 2005CPOL1 min read 56K   866   32   4
A minimalistic FTP server for XPe-powered systems.

MiniFTP screenshot

Introduction

I think that I'm not the only one who's experimenting with XP Embedded - feature rich, componentized version of Windows XP Professional. This system may be used in "black boxes" which contain a fully functional OS, but only with necessary components and may boot from ROM.

Background

The typical way to add FTP functionality in embedded systems powered by XPe is to use IIS FTP. It's relatively easy, but this way has some limitations: the size of image will grow, IIS requires 'heavy' components; IIS cannot be used with Minlogon because it relies on NTLM authentication; for simple tasks like up/downloading some files, IIS is overkill; no easy way to append custom commands. The solution is to use some lightweight FTP server like this one: a single class offers nearly full FTP functionality, and supports commands defined in RFC 959 plus any custom ones. There are several limitations, which won't be critical for embedded FTP servers (from my point of view): only one user with 'administrative' rights, only one directory without subfolders, only one user may be connected to the server.

Using the code

To use the code, just add CFTPServerT<>-based class to your code. Custom command handling may be made through 'command handlers' FTP_COMMAND_HANDLER(_T("some_custom_cmd"), handler_func), you may see the sample in the code, it's well commented. Custom command handlers allow to use any non-standard commands for e.g. remote restart, shutdown, upgrade and any other tasks still using FTP. You may embed this server right into your software, just keep in mind the 'KISS' principle. The sample is an easy console application, but may be converted into a service very quickly.

History

  • August, 2005 - the initial version 1.0.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer TV-Projects
Russian Federation Russian Federation
See my profile @ LinkedIn: http://ru.linkedin.com/in/dmitryivanov
My Blog: http://dmitryivanov.net

Comments and Discussions

 
GeneralExactly what I've been looking for Pin
alanteigne23-Jun-08 5:20
alanteigne23-Jun-08 5:20 
GeneralRe: Exactly what I've been looking for Pin
alanteigne23-Jun-08 11:09
alanteigne23-Jun-08 11:09 
I've compiled the sample app to test this out, but I'm having trouble connecting from a client machine to the server. When I connect locally (ftp localhost) it works fine. Here's a summary of what's happening (first the output of both ends, then mixed together in order):


*** CLIENT SIDE ***
C:\Documents and Settings\jimmy\Desktop\>ftp
ftp> open
To 10.8.4.109
Connected to 10.8.4.109.
220 <welcome message="">
User (10.8.4.109:(none)): admin
Login with USER and PASS
Login failed.
ftp> USER
Username admin
331 User name Ok, need password.
Password:
530 Not logged in.
Connection closed by remote host.
ftp> quit
******

***SERVER SIDE***
========= MiniFTP Server =========
Press any key to close.

FTP Server started (839, ftpserver.h, 00000000)
Connected to 192.168.50.150 (888, ftpserver.h, 00000000)
S: 220 <welcome message=""> (984, ftpserver.h, 00000000)
S: Login with USER and PASS (984, ftpserver.h, 00000000)
R: USER admin (1048, ftpserver.h, 00000000)
S: 331 User name Ok, need password. (984, ftpserver.h, 00000000)
R: USER admin (1048, ftpserver.h, 00000000)
S: 530 Not logged in. (984, ftpserver.h, 00000000)
Disconnected from 192.168.50.150 (926, ftpserver.h, 00000000)
******


***IN ORDER***

SERVER: ========= MiniFTP Server =========
SERVER: Press any key to close.
SERVER:
SERVER: FTP Server started (839, ftpserver.h, 00000000)

CLIENT: C:\Documents and Settings\jimmy\Desktop\>ftp
CLIENT: ftp> open
CLIENT: To 10.8.4.109
CLIENT: Connected to 10.8.4.109.
CLIENT: 220 <welcome message="">
CLIENT: User (10.8.4.109:(none)):

CLIENT: { Entered 'admin' for User }

SERVER: Connected to 192.168.50.150 (888, ftpserver.h, 00000000)
SERVER: S: 220 <welcome message=""> (984, ftpserver.h, 00000000)
SERVER: S: Login with USER and PASS (984, ftpserver.h, 00000000)
SERVER: R: USER admin (1048, ftpserver.h, 00000000)
SERVER: S: 331 User name Ok, need password. (984, ftpserver.h, 00000000)

CLIENT: Login with USER and PASS
CLIENT: Login failed.
CLIENT: ftp>

If the author or anyone else who is familiar with this project could advise, I would appreciate it.
GeneralRe: Exactly what I've been looking for Pin
alanteigne26-Jun-08 5:38
alanteigne26-Jun-08 5:38 
GeneralRe: Exactly what I've been looking for Pin
Dmitry Ivanov27-Jun-08 10:15
Dmitry Ivanov27-Jun-08 10:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.