This page is only available in English.
FTP overview
FTP provides access to internal controller files including variables, programs, diagnostics, safety status, and current position.
FTP (File Transfer Protocol) provides direct access to the Fanuc controller's internal file system. The SDK uses FTP to transfer files (programs, backups) and to read and decode diagnostic data, variables, registers, and safety status.
Key features
- File management: Upload, download, delete, rename files and directories
- Variable reading: Read all system variables in bulk from .va files
- Registers: Read numeric, position, and string registers
- Diagnostics: Safety status, I/O state, current position, error history
- Installed features: Detect available options on the controller
Quick example
using UnderAutomation.Fanuc;using UnderAutomation.Fanuc.Common.Files.Diagnosis;public class Ftp{static void Main(){// Create a new Fanuc robot instanceFanucRobot robot = new FanucRobot();// Set connection parametersConnectionParameters parameters = new ConnectionParameters("192.168.0.1");parameters.Ftp.Enable = true;parameters.Ftp.FtpUser = "user";parameters.Ftp.FtpPassword = "ftp password";// Connect to the robotrobot.Connect(parameters);IOState ioState = robot.Ftp.GetIOState();// Read a variablevar variableFiles = robot.Ftp.GetAllVariables();foreach (var variableFile in variableFiles)foreach (var variable in variableFile.Variables)Console.WriteLine($"{variable.Name} = {variable.Value}");// Read system variable $RMT_MASTERint remoteMode = robot.Ftp.KnownVariableFiles.GetSystemFile().RmtMaster;// Read safety statusSafetyStatus safetyStatus = robot.Ftp.GetSafetyStatus();Console.WriteLine($"Emergency Stop: {safetyStatus.ExternalEStop}");Console.WriteLine($"Teach Pendant Enabled: {safetyStatus.TPEnable}");// Get current position for each arm (Joints, World position of each tool, user frame positions)CurrentPosition currentPosition = robot.Ftp.GetCurrentPosition();// Upload a TP program to the controllerrobot.Ftp.DirectFileHandling.UploadFileToController(@"C:\Programs\MyPrg.tp", "md:/MyPrg.tp");// Download a file from the robotrobot.Ftp.DirectFileHandling.DownloadFileFromController("md:/Backup.va", @"C:\Backup\Backup.va");// Delete a file on the robotrobot.Ftp.DirectFileHandling.DeleteFile("md:/OldProgram.tp");}}
Connection
static void Main(){// Via FanucRobotvar robot = new FanucRobot();var parameters = new ConnectionParameters("192.168.0.1");parameters.Ftp.Enable = true;parameters.Ftp.FtpUser = ""; // usually emptyparameters.Ftp.FtpPassword = ""; // usually emptyparameters.Ftp.FtpTimeoutMs = 30000; // optional, default is 30 secondsrobot.Connect(parameters);// Or standalonevar ftp = new FtpClient();ftp.Connect("192.168.0.1", "", "");}}
Click to see the full code
The FtpTimeoutMs property controls the connection, read, and data transfer timeouts. The default is 30,000 ms (30 seconds). Lower it for faster failure detection on unreachable controllers, or raise it for slow networks.
Limitations
- Read-only for most data: Variables and diagnostics are read-only via FTP. Use Telnet, SNPX, or CGTP to write values
- Slower than SNPX: FTP transfers entire files rather than individual values
- No real-time data: Data represents a snapshot at the time of the FTP request
Next steps
- File management : Upload, download, delete files
- Diagnostics & variables : Safety status, registers, variables
API reference
FTP Client connection to a robot
| Member | Type | Description |
|---|---|---|
FtpClient() Constructor | Instanciate a new FTP client connection | |
Connect(string, string, string, int, int) Method | void | Connect to a robot
|
Base class for FTP features
| Member | Type | Description |
|---|---|---|
Connected Property read only | bool | Indicates that FTP connection is active |
DirectFileHandling Property read only | FtpDirectFileHandling | Contains methods to manipulate files and folders on the controller (upload, download, delete, ...) |
IP Property read only | string | Connect robot IP address or host name |
Language Property | Languages | Controller language (default is English) |
Disconnect() Method | void | Disconnects from FTP server |
EnumerateVariableFileNames() Method | string[] | Get the list of all variable file names available on the controller |
EnumerateVariableFiles() Method | FtpListItem[] | Get a list of all variable files on controller |