Re: How to develop FTP Server On PPC?

From: John Spaith [MS] (jspaith_at_ONLINE.microsoft.com)
Date: 11/16/04


Date: Tue, 16 Nov 2004 09:32:03 -0800

As I indicated below, I'm not able to share out the source code to the CE
FTP server due to licensing restrictions. Sorry.

This sounds kind of like a Peer 2 Peer network you're setting up. Maybe
there's some sort of free software already that does this?

If you have to build this from scratch AND you control both the client and
the server portions (there's no FTP client to my knowledge on CE), I would
recommend against using FTP. You would only need FTP if you need existing
FTP clients to be able to use your server. This gives you the flexbility to
create your own custom protocol that is considerably easier to implement
than FTP is.

Here's how I would implement this if I had to: use an HTTP based protocol.
You can use the CE Web Server (which is included in the PocketPC SDK and you
can redistribute) as the server and write a relatively simple ISAPI
extension to retrieve the data. So you'd have say virtual root /MyUpload
point to \windows\myUploadIsapi.dll, and that DLL would know how to write to
the filesystem data it got. The clients could use Wininet (or equivalent
logic in Compact Framework library) to send data to the appropriate server.

I'd create the HTTP client requests in wininet to be something like
<Open connection to remote PPC server>
PUT /MyUpload?fileName=\temp\uploadedfile.txt
Content-Length: <whatever>

<Contents of the data you wish to post>

--
The ISAPI just has to parse out the ?FileName in the query string to figure 
out where to write to, then read in the HTTP body and write it to a file.
Note that there are huge security concerns with writing any server so 
carefully understand what you're doing here.  A nice thing about using the 
Web Server is that it can automatically handle not only the socket creation, 
maintenence, etc... but can also allow you to setup security on the 
/MyUpload virtual root so only authenticated users can get in.
See Web Server and WinInet documentation in MSDN for implementation details. 
Hope this helps.
-- 
John Spaith
Software Design Engineer, Windows CE
Microsoft Corporation
Check out the new CE Networking Team Blog at http://blogs.msdn.com/cenet/.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2003 Microsoft Corporation. All rights 
reserved.
"Jonathan Tong" <ABC@yahoo.com.hk> wrote in message 
news:uraLsl%23yEHA.2568@TK2MSFTNGP10.phx.gbl...
> Hi John
>
> Thanks for your reply.
>
> Actually i would like to write an application for PPC to PPC(more than 20
> PPC)  to share their files.
>
> Do u have any suggestion for this solution.
>
> In Platform builder have sample? Could u mind to e-mail the sample for me?
> because i have not install the PB at my PC.
>
> My E-mail : jonathan234hk@yahoo.com.hk
>
> Hope i can learn more from your experience.
>
> Jonathan Tong
>
> "John Spaith [MS]" <jspaith@ONLINE.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D
> :OsuBHI1yEHA.1040@TK2MSFTNGP10.phx.gbl...
>> It is possible to do an FTP server on CE -- in fact in Platform Builder
> (for
>> embedded CE devices) there is an FTP server sample.  Unfortunately this
>> isn't available for PocketPC's.
>>
>> Question - do you really need to write an FTP server?  There may also
>> already be FTP servers in shareware/freeware for PPC already, so I'd look
>> before writing one.  There is a web server that ships in the PocketPC SDK
>> that will allow you to download files remotely, though not upload.  Is
> there
>> some other file sharing technology you can use that's not FTP related?
>> Writing an FTP server isn't rocket science, but it's not trivial either.
>> The CE Platform builder one is 3500 lines long, to give an indication.
>>
>> And sorry - I can't share the existing Microsoft CE FTP Server with you
>> because of licensing restrictions.
>>
>> Also be aware that if you only want to run this on a PocketPC tied to
>> ActiveSync already, it's not going to be worth it.  There's a lot of 
>> weird
>> issues with ActiveSync and servers and the FTP protocol that make this
> hard,
>> and ActiveSync already has a very nice file explorer anyway to transfer
>> files.
>>
>> If you must write an FTP server, do it exactly as if you were 
>> implementing
> a
>> winsock based service using Winsock on Windows XP.  Just a few of the
>> Winsock API's you'd need would be socket(), accept(), send(), recv(),
> etc...
>> Again, I'd make sure that FTP is the right way to solve the problem 
>> before
>> digging into this any.
>>
>> -- 
>> John Spaith
>> Software Design Engineer, Windows CE
>> Microsoft Corporation
>>
>> Check out the new CE Networking Team Blog at 
>> http://blogs.msdn.com/cenet/.
>>
>> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>> You assume all risk for your use. ?2003 Microsoft Corporation. All rights
>> reserved.
>>
>> "Jonathan Tong" <ABC@yahoo.com.hk> wrote in message
>> news:%237X%23dHkyEHA.2016@TK2MSFTNGP15.phx.gbl...
>> > Hi Everyone,
>> >
>> > I'm going to  start develop a application be a ftp server?
>> >
>> > Is it impossible?
>> >
>> > If not how should i start the application ?
>> >
>> > Thanks a lot
>> >
>> > Jonathan
>> >
>> >
>>
>>
>
> 


Relevant Pages

  • Re: Using COM OutProc server on WinCE
    ... nk.exe (kernel process) and you can't popup UI from nk.exe in CE 6.0. ... Microsoft Corporation ... to the client so I guess in that scenario services.exe won't be helpful. ... Server (you'd need SYSGEN_DCOM, see ...
    (microsoft.public.windowsce.app.development)
  • Re: Formatting ASCII to be read by Windows NotePad
    ... I've had issues in the past uploading to a MacOS based ftp server ... It can be a client and/or server software issue. ... remote FTP server you are given to connect to will be setup right. ...
    (comp.lang.perl.misc)
  • Re: how to upload a file with chinese filename to ftp server in vb.
    ... the IIS FTP server has limited support for multi-byte character ... client and server be exactly the same. ... special characters or file-system special characters, ...
    (microsoft.public.win32.programmer.networks)
  • Re: timezone missing for ftp transfers...
    ... > from our Win2k server the timezone is ignored and the file ... This is going to depend on what the client software uses to set the local ... measure (because the client can't tell what time zone is set at the server ... but the FTP server in IIS behaves correctly for either ...
    (microsoft.public.inetserver.iis.ftp)
  • RE: FTP Problems
    ... server on SBS from an XP client, but you cannot access the FTP server on XP ... Try to use IE on the SBS server to access the FTP on the XP client. ...
    (microsoft.public.windows.server.sbs)