B4R Tutorial ESP8266 FTP Client

Discussion in 'B4R Tutorials' started by Erel, Dec 21, 2016.

  1. Erel

    Erel Administrator Staff Member Licensed User

    To complete the B4X FTP season (https://www.b4x.com/android/forum/threads/74320/#content) I've written a client in B4R.

    It allows to connect to a FTP server and download or upload files.

    There is no SD card involved in this example. It downloads a file and prints its content and uploads a string (array of bytes) as the file content.

    The file is stored in an array of bytes (FileBuffer). Its size is set to 1000. You can increase it if you want to download or upload larger files.

    This example is based on the very useful GlobalStore module: https://www.b4x.com/android/forum/threads/module-globalstore-global-objects-storage.73863/#content
    Note that GlobalStore was rewritten due to a bug in the previous version.

    This is not a simple example as the FTP protocol is not so simple.
    It is worth going over the code that handles the server messages.
    The code in AStreamControl_NewData parses the incoming data and splits it based on the end of line characters.
    The last line can be incomplete so it is stored in GlobalStore and is added to the next message.

    Attached Files:

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice