Using the NetIO (Network File System) Client on an Embedded Device

Accessing files remotely can be beneficial as a permanent solution or during development phases. The Barracuda App Server provides a Network File Server, known as the Web File Server, and a Network File Client, referred to as NetIO. Together, they enable one Barracuda App Server to serve files to another.


The Web File Server and NetIO are programmable, allowing for the creation of instances using C and Lua code. This tutorial will show how to activate these components using two development environments that offer a no-code option for configuring and setting up a client/server file system. Here, the Mako Server will function as the Network File Server, while the Xedge IDE will serve as the Network File Client. The Mako Server will operate on your host operating system, such as Windows or Linux, and the NetIO will be activated through the Xedge IDE, which can run on an embedded device or as an application on another Mako Server instance. For more information, refer to the Xedge IDE documentation.

Configuring the Mako Server

Begin by downloading and installing the Mako Server for your host operating system. Familiarize yourself with starting the server using the command line.

Next, create a directory specifically for this tutorial on your file system, for example, C:\Users\[username]\tutorial on Windows or /home/[username]/tutorial on Linux.

Within this directory, create a new file named mako.conf and insert the following configuration:


The above configuration details are available in the Web File Server section of the Mako Server documentation.

Then, launch the Mako Server in this directory. You should see an output similar to:

Loading c:\Users\[username]\tutorial\mako.conf
Mounting /c/Users/[username]/tutorial/
Server listening on IPv6 port 80
Server listening on IPv4 port 80
Loading certificate MakoServer
SharkSSL server listening on IPv6 port 443
SharkSSL server listening on IPv4 port 443
Creating file server at /fs/ -> c:\Users\[username]\tutorial\ ok
Warning: unprotected file server.

This output indicates that the Mako Server has successfully integrated a Web File Server instance into the virtual file system at "/fs/". Confirm this by navigating to http://localhost/fs/. You should see the content of the "tutorial" directory in your browser. In the above example, the server listens on port 80. If the server is not listening on port 80, include the port number in the URL e.g. http://localhost:9357/fs/

Configuring the NetIO using the Xedge IDE

Note: The following code was developed and tested using the ESP32 version of Xedge, called Xedge32. Consider reading the tutorial Your First Xedge32 Project before proceeding, as this tutorial includes introductory information, including a video, on using the Xedge IDE.

Before using the Xedge IDE, find the IP address of your host computer and replace the URL http://localhost/fs/ with a URL similar to and make sure you can navigate to this URL.

In the "tutorial" directory, create a new subdirectory and call it "MyLib." Use the Web File Server and navigate to this directory, e.g., to Copy this URL.

In the Xedge IDE, right-click the "net" file system in the left pane tree view and select a new app.

In the name field, enter "MyLib". In the URL field, paste the Web File Server URL, click the Running button, and click Save.

Xedge New Application

Figure 1: The Xedge new Application Configuration wizard: adding a new NetIO-powered app.

You can now use the NetIO-enabled app like any other Xedge-managed app. In the following figure, we have created "test.xlua" using Xedge IDE. This file is saved to the MyApp directory on the host computer. You can edit files directly on your host computer using any editor, but note that new files are not visible in the Xedge IDE unless you click the browser's refresh button.

Xedge Test File

Figure 2: A test file created using Xedge IDE and saved to the host computer's file system using NetIO.

How to Use the NetIO to Develop a Lua Module

NetIO proves invaluable when developing large-scale programs, such as extensive Lua modules. This section guides you through creating a Lua module using the Xedge IDE and NetIO.

Begin by creating a .preload script in the MyLib directory. Copy and paste the following Lua code into the .preload script:


function onunload()

For the moment, proceed with this file as is. We will delve into its mechanics later.

Next, create a subdirectory named .lua. Create a file named MyModule.xlua within this directory and copy the Lua code below into MyModule.xlua:

trace "Loading MyModule"
return {

Xedge Lua Module

Figure 3: The Lua Module MyModule created in the .lua sub-directory.

Now, restart the MyLib app via the Xedge IDE to execute the new .preload script (click .appcfg and toggle run button).

In the test.xlua file, insert the following code:


This script will load the module and print the version number. Additionally, you should see the message "Loading MyModule" in the output, which originates from the print statement in MyModule.lua. It's worth noting that the only requirement for a Lua module is to return a Lua table. Refer to the Lua modules documentation for more details on module creation.

Understanding the .preload Script

The xedge.createloader() function is an Xedge-specific feature that allows the MyLib application to act as a Lua module loader. It injects special code enabling the "require" function to locate modules within the .lua subdirectory. For comprehensive details, consult the xedge.createloader() documentation.

The onunload() function is executed when the application is terminated through the Xedge IDE. This function removes MyModule from Lua's package.loaded table, ensuring that upon application restart, the module is reloaded and not cached. This behavior is crucial during module development, allowing for the iterative testing of the module without the need to reboot the entire device.

Programmatically Creating a NetIO Instance

A NetIO instance can be created programmatically using the following code snippet:

local nio = ba.mkio(ba.openio"net", "")
for name in nio:files("/") do

You can copy this code and execute it within the Xedge IDE. However, ensure you modify the URL to match your configuration before running the script.

Looking for Guidance?

Don't let networking, security, and device management hold you back! Let Real Time Logic help your business, development team, or customers save time and money by handling these complex tasks for you.

With a wealth of experience creating IoT solutions and embedded device interfaces, we're well-equipped to dramatically improve your products and how you build them. And if you prefer to tackle things on your own, check out our extensive list of embedded web server and IoT tutorials.

Whether you choose to work with us or take the DIY route, we're here to help you succeed. Let's team up and make your vision a reality!


OPC-UA Client & Server

An easy to use OPC UA stack that enables bridging of OPC-UA enabled industrial products with cloud services, IT, and HTML5 user interfaces.

Edge Controller

Edge Controller

Use our user programmable Edge-Controller as a tool to accelerate development of the next generation industrial edge products and to facilitate rapid IoT and IIoT development.

On-Premises IoT

On-Premises IoT Platform

Learn how to use the Barracuda App Server as your On-Premises IoT Foundation.

Embedded Web Server

Barracuda Embedded Web Server

The compact Web Server C library is included in the Barracuda App Server protocol suite but can also be used standalone.

WebSocket Server

Microcontroller Friendly

The tiny Minnow Server enables modern web server user interfaces to be used as the graphical front end for tiny microcontrollers. Make sure to check out the reference design and the Minnow Server design guide.

WebDAV Server

Network File System

Why use FTP when you can use your device as a secure network drive.

HTTP Client

Secure HTTP Client Library

PikeHTTP is a compact and secure HTTP client C library that greatly simplifies the design of HTTP/REST style apps in C or C++.

WebSocket Client

Microcontroller Friendly

The embedded WebSocket C library lets developers design tiny and secure IoT applications based on the WebSocket protocol.

SMTP Client

Secure Embedded SMTP Library

Send alarms and other notifications from any microcontroller powered product.

Crypto Library

RayCrypto C Library

The RayCrypto engine is an extremely small and fast embedded crypto library designed specifically for embedded resource-constrained devices.

Embedded PKI Service

Automatic SSL Certificate Management for Devices

Real Time Logic's SharkTrust™ service is an automatic Public Key Infrastructure (PKI) solution for products containing an Embedded Web Server.


Modbus TCP client

The Modbus client enables bridging of Modbus enabled industrial products with modern IoT devices and HTML5 powered HMIs.

Posted in Whitepapers