NFSClient Class

Properties   Methods   Events   Config Settings   Errors  

This class is used to create a Network File System (NFS) client based on NFS version 4.0.

Class Name

NFSSDK_NFSClient

Procedural Interface

 nfssdk_nfsclient_open();
 nfssdk_nfsclient_close($res);
 nfssdk_nfsclient_register_callback($res, $id, $function);
 nfssdk_nfsclient_get_last_error($res);
 nfssdk_nfsclient_get_last_error_code($res);
 nfssdk_nfsclient_set($res, $id, $index, $value);
 nfssdk_nfsclient_get($res, $id, $index);
 nfssdk_nfsclient_do_abort($res);
 nfssdk_nfsclient_do_append($res);
 nfssdk_nfsclient_do_changeremotepath($res, $remotepath);
 nfssdk_nfsclient_do_checkfileexists($res);
 nfssdk_nfsclient_do_config($res, $configurationstring);
 nfssdk_nfsclient_do_connect($res);
 nfssdk_nfsclient_do_createfile($res, $filename);
 nfssdk_nfsclient_do_createlink($res, $linkname, $linktarget, $linktype);
 nfssdk_nfsclient_do_deletefile($res, $filename);
 nfssdk_nfsclient_do_disconnect($res);
 nfssdk_nfsclient_do_doevents($res);
 nfssdk_nfsclient_do_download($res);
 nfssdk_nfsclient_do_downloadrange($res, $path, $filename, $startbyte, $count, $buffer);
 nfssdk_nfsclient_do_listdirectory($res);
 nfssdk_nfsclient_do_makedirectory($res, $newdir);
 nfssdk_nfsclient_do_queryfileattributes($res);
 nfssdk_nfsclient_do_readlink($res, $linkname);
 nfssdk_nfsclient_do_removedirectory($res, $dirname);
 nfssdk_nfsclient_do_renamefile($res, $newname);
 nfssdk_nfsclient_do_reset($res);
 nfssdk_nfsclient_do_updatefileattributes($res);
 nfssdk_nfsclient_do_upload($res);
 nfssdk_nfsclient_do_uploadrange($res, $path, $filename, $startbyte, $count, $buffer);

Remarks

This class provides a simple way to create a Network File System (NFS) client, enabling seamless connection and access to files hosted on an NFS server.

Getting Started

To begin, the RemoteHost and RemotePort properties should first be set to the host and port of the NFS server. By default, the RemotePort property is set to 2049. The LocalHost and LocalPort properties may also be set to specify the name of the local host or user-assigned IP interface through which connections are initiated. Note that NFS exports may require that requests originate from a port less than 1024 (IPPORT_RESERVED). In this case, LocalPort should be manually specified.

The SecurityMechanism (and other related properties) may also be set beforehand. Please refer to the security section below for additional details.

Once set, the Connect method should be called to initiate a connection to the server. For example:

component.RemoteHost = "10.0.1.123"; component.RemotePort = 2049; component.Connect();

Once the connection is successful (or fails), the Connected event will fire accordingly, with details regarding the connection status. Assuming the connection was successful, the Connected property will be set to True.

After successfully connecting to the NFS server, the RemotePath will always be set to the root from the classes perspective, /.

If the server exports a specific directory (e.g., /mnt/mynfs), the class may need to navigate to this export manually by calling ChangeRemotePath with the relevant export path.

In some server-side configurations, the client may already start in the exported directory upon a connection, allowing immediate access without additional navigation.

Security

Before connecting to the server, the SecurityMechanism should be set accordingly. This property may be set to one of the following mechanisms:

MechanismDescription
noneNo authentication is required to establish a connection to the server (AUTH_NONE or AUTH_NULL).
sysSystem authentication is required to establish a connection to the server (AUTH_SYS or AUTH_UNIX).
krb5Kerberos v5 with client authentication only.
krb5iKerberos v5 with client authentication and integrity protection.
krb5pKerberos v5 with client authentication, integrity protection, and encryption.

System Authentication

By default, SecurityMechanism is set to sys, enabling RPC system authentication (AUTH_SYS). In this case, the RPCUid and RPCGid properties are used to specify the UID and GID the class should perform the request as. These properties are set to 0 by default, indicating root access.

Note: This mechanism is not secure. Network packets are still transferred in plaintext. This mechanism is only recommended for systems operating over a local network.

Kerberos Authentication

For additional security, the SecurityMechanism may be set to krb5, krb5i, or krb5p to enable RPC Kerberos authentication (RPCSEC_GSS).

It is important to note the differences between the listed Kerberos security mechanisms. If krb5 is utilized, Kerberos will only be used to perform client authentication.

If krb5i is utilized, Kerberos will be used to perform client authentication and integrity protection, ensuring that incoming and outgoing packets are untampered. However, packets remain unencrypted, making sensitive data potentially visible to anyone monitoring the network.

If krb5p is utilized, Kerberos will be used to perform client authentication, integrity protection, and packet encryption, making this the most secure option.

If the security mechanism is set to any of the Kerberos security mechanisms, the following properties must also be set accordingly:

For example, connecting with a Kerberos security mechanism may look like:

// Configure general settings nfsclient.RemoteHost = "10.0.1.223"; nfsclient.RemotePort = 2049; nfsclient.SecurityMechanism = "krb5p"; // Configure kerberos settings nfsclient.KDCHost = "10.0.1.226"; nfsclient.User = "nfsclient@EXAMPLE.COM"; nfsclient.SPN = "nfs/nfs-server.example.com"; nfsclient.KeytabFile = "C:\\nfsclient.keytab"; // alternative to 'Password' nfsclient.Connect();

Navigating the Server

As mentioned previously, upon successfully connecting to the NFS server, the RemotePath will always be set to the root from the classes perspective, /. ChangeRemotePath may or may not need to be called to navigate to the relevant server-side export.

Regardless, many methods operate based on the current working directory of the class as identified by RemotePath. For example, when calling ListDirectory, the directory contents of the current RemotePath will be listed.

As such, the ChangeRemotePath method can be used to change the current working directory of the class to some specified path. Both relative and absolute paths are supported with this method.

Absolute Paths

If the path begins with a /, it is considered an absolute path and must specify the entire path from the root of the server. For example:

component.ChangeRemotePath("/home/testuser/myfolder");

Relative Paths

If the path does not begin with a /, it is considered a relative path and is resolved in relation to the current directory. For instance, a value of myfolder will indicate a subfolder of the current directory. The special value .. refers to the parent directory of the current path. For example:

//Change to the 'myfolder' sub-directory component.ChangeRemotePath("myfolder"); //Navigate up two levels and then into the 'another/folder' path. component.ChangeRemotePath("../../another/folder");

Note that absolute and relative paths are supported for almost every class method that takes a file name and path as a parameter. Additionally, absolute and relative paths are supported by the RemoteFile property, which many methods make use of. For more information, please refer to the below section and individual method descriptions.

Managing Files and Directories

This section describes many different operations that can be performed on the NFS server. Before going into additional details, it is important to note that the behavior of many methods here operate depending on whether the specified RemoteFile or method parameter is an absolute or relative path.

If the specified RemoteFile or method parameter is an absolute path, the current RemotePath will be ignored in favor of the absolute path. However, if the specified RemoteFile or method parameter is a relative path, the operation will be performed relative to the current RemotePath.

File Lookup

To check whether a file or directory exists in the NFS server, the CheckFileExists method may be used. This method will search for the object specified by RemoteFile. For example:

// Relative Path component.ChangeRemotePath("/home/testuser/myfolder"); component.RemoteFile = "test.txt"; // Checks for test.txt in /home/testuser/myfolder if(component.CheckFileExists()) { component.Download(); } // Absolute Path component.RemoteFile = "/home/test/test.txt"; // Checks for test.txt in /home/test if(component.CheckFileExists()) { component.Download(); }

Listing Directories

To list the contents of a directory, the ListDirectory method should be called to retrieve the entries of the current working directory (as indicated by the current RemotePath).

The DirList event will fire for each entry in the current directory. The RemoteFile property may be used to specify a file mask for filtering the entries returned via DirList.

For example:

// List all text files in /home/test component.OnDirList += (o, e) => { Console.WriteLine("Dir Entry: " + e.FileName); }; component.ChangeRemotePath("/home/test"); component.RemoteFile = "*.txt"; component.ListDirectory();

Note: Because RemoteFile acts as a file mask, to retrieve a complete directory listing RemoteFile should be set to an empty string (or a mask like "*").

For more information about using RemoteFile as a filemask, please refer to the RemoteFile or ListDirectory documentation.

Create and Delete Objects

Files and directories may be created using CreateFile and MakeDirectory, respectively. Note that CreateFile is used to create a new file containing no data. To create a new file with content, please refer to the Upload method. For example:

// Create directory component.MakeDirectory("testdir"); // Create empty file in new directory component.ChangeRemotePath("testdir"); component.CreateFile("test.txt");

Files and directories may be deleted using DeleteFile and RemoveDirectory, respectively. For example (based on the previous directory structure in the last example):

// Remove file created previously component.ChangeRemotePath("testdir"); component.DeleteFile("test.txt"); // Navigate out of directory component.ChangeRemotePath("../"); component.RemoveDirectory("testdir");

Uploading Files

As mentioned, CreateFile may be used to create a new, empty file. To upload a file with content, the Upload method should be used. The RemoteFile property will specify the remote location to upload the local data to. If the RemoteFile exists and Overwrite is set to false, an error will occur while uploading.

The class can either upload the specified LocalFile, or upload the contents of a stream, which can be set via SetUploadStream. When uploading via a stream, the CloseStreamAfterTransfer config may be set to determine whether or not to close the stream after the transfer (enabled by default).

As an alternative to Upload, the UploadRange method may be used to upload a specified number of bytes to a given position in the RemoteFile. This method can also be used to append data to the end of a file, however, the Append method may be also be used for this purpose. For specific examples, please refer to the documentation for each method.

Downloading Files

To download the content of a file hosted on the server, the Download method should be used. The RemoteFile property should be set to the remote file to download. The LocalFile property can be used to specify a local file to download the specified remote file to. If the LocalFile already exists and Overwrite is false, an error will occur.

The class can either download the remote file contents to the specified LocalFile, or download the contents to a stream, which can be set via SetDownloadStream. When downloading via a stream, the CloseStreamAfterTransfer config may be set to determine whether or not to close the stream after the transfer (enabled by default).

As an alternative to Download, the DownloadRange method may be used to download a specified number of bytes to some local buffer.

Lastly, as an alternative to LocalFile or SetDownloadStream, the downloaded file contents are also available in the Transfer event. Note the Transfer event will always fire containing the transferred data, so data may be retrieved here even if LocalFile is set or SetDownloadStream is called. For specific examples, please refer to the documentation for each method.

Creating and Reading Links

The class supports creating hard links and symbolic links using the CreateLink method.

CreateLink takes three parameters, the name of the link to be created, the target of the link, and the type of link (hard link or symbolic link). Please see below for a simple example:

nfs.ChangeRemotePath("/nfs"); // Create symlink.txt in /nfs pointing to existing_file.txt in the same directory nfs.CreateLink("symlink.txt", "existing_file.txt", 0); // Create hardlink.txt in /nfs pointing to existing_file.txt in the same directory nfs.CreateLink("hardlink.txt", "existing_file.txt", 1);

To read a hard link, you can set the RemoteFile property to the name of the hard link, and call Download (with the relevant local file or stream set).

However, reading a symbolic link requires some additional steps. First, the ReadLink method should be called, which will return a byte array containing the contents of the symbolic link as stored on the server. Typically, the contents are a file name that the link points to. Before going into detail, please see below for a simple example:

nfs.ChangeRemotePath("/nfs"); // Create symlink.txt in /nfs pointing to existing_file.txt in the same directory nfs.CreateLink("symlink.txt", "existing_file.txt", 0); // Read link byte[] linkData = nfs.ReadLink("symlink.txt"); string file = Encoding.UTF8.GetString(linkData); nfs.RemoteFile = file; nfs.LocalFile = "temp.txt"; nfs.Download();

In NFS v4.0, the contents of a symbolic link are treated as opaque (binary data) at the protocol level. The server stores this opaque data and returns this to the client when requested, meaning it is up to the client to interpret the link data.

Most of the time, the opaque data will represent the file the symbolic link is pointing to relative to the position of the symbolic link, meaning it can be converted to a UTF8 string representing this file. The contents of the file should then be downloaded by setting RemoteFile (and possibly RemotePath) accordingly and calling Download.

Handling File Attributes

The class provides a couple of ways to handle file attributes. As mentioned previously, when calling ListDirectory, the DirList event will fire for each directory entry. During this event, the FileAttributes collection will be populated with the attributes of the associated directory entry. Note that the attributes are only meant to be retrieved during this event, rather than set.

Outside of DirList, the QueryFileAttributes method must be called to retrieve a file's attributes. After doing so, the FileAttributes property will be populated accordingly.

To update relevant file attributes, the FileAttributes property can be modified, and UpdateFileAttributes can be called to make those changes remotely. Note that not all attributes are able to be modified. Please see below for a simple example:

// First, query attributes component.RemoteFile = "/home/test/test.txt"; component.QueryFileAttributes(); // Update OwnerId and OwnerGroupId of file component.FileAttributes.OwnerId = "1000"; component.FileAttributes.OwnerGroupId = "1000"; component.UpdateFileAttributes();

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

ConnectedWhether the class is connected.
FileAccessTimeContains the number of seconds since 12:00:00 AM, January 1, 1970, when this file was last accessed.
FileAccessTimeNanosContains a subsecond value associated with this file's AccessTime .
FileAllocationSizeNumber of file system bytes allocated to this file object.
FileCreationTimeSpecifies the number of seconds since 12:00:00 AM, January 1, 1970, when this file was created.
FileCreationTimeNanosContains a subsecond value associated with this file's CreationTime .
FileTypeThe type of file.
FileIsDirSpecifies whether or not the file represented by these attributes is a directory.
FileIsSymlinkSpecifies whether or not the file or directory represented by these attributes is a symbolic link.
FileLinkCountNumber of hard links to this object.
FileMIMETypeSpecifies a value that can be used in the Content-Type header for a MIME entity part containing this file.
FileModeMode of a file.
FileModifiedTimeSpecifies the number of seconds since 12:00:00 AM, January 1, 1970, that this file was last modified.
FileModifiedTimeNanosIncludes a subsecond value associated with this file's ModifiedTime .
FileOwnerGroupIdThe string name of the group ownership of this object.
FileOwnerIdThe string name of the owner of this object.
FileSizeSpecifies the total size, in bytes, of this file.
FirewallAutoDetectWhether to automatically detect and use firewall system settings, if available.
FirewallTypeThe type of firewall to connect through.
FirewallHostThe name or IP address of the firewall (optional).
FirewallPasswordA password if authentication is to be used when connecting through the firewall.
FirewallPortThe Transmission Control Protocol (TCP) port for the firewall Host .
FirewallUserA username if authentication is to be used when connecting through a firewall.
KDCHostSpecifies domain name or IP address of the Key Distribution Center (KDC).
KDCPortSpecifies the port for the Key Distribution Center (KDC).
KeytabFileSpecifies the path to the Kerberos Keytab file.
LocalFileThis is the path to a local file for download or upload. If the file exists, it is overwritten.
LocalHostThe name of the local host or user-assigned IP interface through which connections are initiated or accepted.
LocalPortThe TCP port in the local host where the class binds.
OverwriteThis indicates whether the class should overwrite the local or remote file during a download or upload.
PasswordSpecifies the password of the User to authenticate.
RemoteFileThis is the name of the remote file for uploading, downloading, and performing other operations.
RemoteHostSpecifies the address of the NFS server.
RemotePathSpecifies the current path in the NFS server.
RemotePortSpecifies the port the NFS server is listening on.
RPCGidSpecifies the group identifier (GID) associated with requests during RPC system authentication.
RPCUidSpecifies the user identifier (UID) associated with requests during RPC system authentication.
SecurityMechanismSpecifies the RPC security mechanism the client should use when connecting to the NFS Server.
SPNSpecifies the Service Principal Name (SPN).
StartByteThe offset in bytes at which to begin the Upload or Download.
TimeoutThis property includes the timeout for the class.
UserSpecifies the name and domain of the user to authenticate.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

AbortAborts the current upload or download.
AppendAppends data from LocalFile to a remote file RemoteFile on a NFS server.
ChangeRemotePathChanges the current path on the server.
CheckFileExistsChecks whether the file specified by RemoteFile exists on the server.
ConfigSets or retrieves a configuration setting.
ConnectThis method connects to the NFS server.
CreateFileCreates a file on the NFS server.
CreateLinkCreates a hard link or symbolic link on the server.
DeleteFileThis method removes a file specified by FileName from the server.
DisconnectThis method disconnects from the NFS server.
DoEventsThis method processes events from the internal message queue.
DownloadThis method downloads a remote file from the NFS server.
DownloadRangeThis method downloads a specific segment of a remote file from a NFS server.
ListDirectoryThis method lists the current working directory on the NFS server.
MakeDirectoryThis method is used to create a directory on the NFS server.
QueryFileAttributesThis method queries the server for the file attributes of the specified RemoteFile .
ReadLinkReads a symbolic link on the server.
RemoveDirectoryThis removes a directory specified by DirName from the NFS server.
RenameFileThis changes the name of RemoteFile to NewName .
ResetThis method will reset the class.
UpdateFileAttributesThis method updates the FileAttributes for the current RemoteFile .
UploadThis method uploads a file to the NFS server.
UploadRangeThis method uploads a specific segment of data into a remote file on the NFS server.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

ConnectedFired immediately after a connection completes (or fails).
DirListThis event fires when a directory entry is received.
DisconnectedThis event is fired when a connection is closed.
EndTransferThis event is fired when a file finishes uploading or downloading.
ErrorFired when information is available about errors during data delivery.
LogThis event is fired once for each log message.
StartTransferThis event is fired when a file starts uploading or downloading.
TransferThis event is fired during the file download or upload.

Config Settings


The following is a list of config settings for the class with short descriptions. Click on the links for further details.

AppendToLocalFileWhether to append downloaded files to a local file.
ClientIDSeekSpecifies some identifier used when creating the client ID associated with the current connection.
DirCountSizeSpecifies the maximum number of bytes that may be returned in a single READDIR request.
FileTimeFormatSpecifies the format to use when returning filetime strings.
MaxReadBytesIndicates the maximum number of bytes that will be returned in one READ operation.
MaxWriteBytesIndicates the maximum number of bytes that will be written in one WRITE operation.
OpenOwnerSpecifies an opaque string representing the client when opening a file.
RPCAuxiliaryGidsSpecifies the Auxiliary GIDs (or groups) the client is a part of.
RPCHostnameSpecifies the host (or machine) name of the client.
STMaskSpecifies the default file mode (or permission) bits to exclude when creating a file.
UsePlatformKerberosAPIWhether to use the platform Kerberos API.
XAttrCountSizeSpecifies the maximum number of bytes that may be returned in a single LISTXATTRS request.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
MaskSensitiveDataWhether sensitive data is masked in log messages.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPIWhether or not to use the system security libraries or an internal implementation.

Connected Property (NFSSDK_NFSClient Class)

Whether the class is connected.

Object Oriented Interface

public function getConnected();

Procedural Interface

nfssdk_nfsclient_get($res, 1 );

Default Value

false

Remarks

This property is used to determine whether or not the class is connected to the remote host. Use the Connect and Disconnect methods to manage the connection.

This property is read-only and not available at design time.

Data Type

Boolean

FileAccessTime Property (NFSSDK_NFSClient Class)

Contains the number of seconds since 12:00:00 AM, January 1, 1970, when this file was last accessed.

Object Oriented Interface

public function getFileAccessTime();
public function setFileAccessTime($value);

Procedural Interface

nfssdk_nfsclient_get($res, 2 );
nfssdk_nfsclient_set($res, 2, $value );

Default Value

0

Remarks

Contains the number of seconds since 12:00:00 AM, January 1, 1970, when this file was last accessed.

This property is not available at design time.

Data Type

Long64

FileAccessTimeNanos Property (NFSSDK_NFSClient Class)

Contains a subsecond value associated with this file's AccessTime .

Object Oriented Interface

public function getFileAccessTimeNanos();
public function setFileAccessTimeNanos($value);

Procedural Interface

nfssdk_nfsclient_get($res, 3 );
nfssdk_nfsclient_set($res, 3, $value );

Default Value

0

Remarks

Contains a subsecond value associated with this file's FileAccessTime.

This property is not available at design time.

Data Type

Integer

FileAllocationSize Property (NFSSDK_NFSClient Class)

Number of file system bytes allocated to this file object.

Object Oriented Interface

public function getFileAllocationSize();

Procedural Interface

nfssdk_nfsclient_get($res, 4 );

Default Value

0

Remarks

Number of file system bytes allocated to this file object.

This property is read-only and not available at design time.

Data Type

Long64

FileCreationTime Property (NFSSDK_NFSClient Class)

Specifies the number of seconds since 12:00:00 AM, January 1, 1970, when this file was created.

Object Oriented Interface

public function getFileCreationTime();

Procedural Interface

nfssdk_nfsclient_get($res, 5 );

Default Value

0

Remarks

Specifies the number of seconds since 12:00:00 AM, January 1, 1970, when this file was created.

This property is read-only and not available at design time.

Data Type

Long64

FileCreationTimeNanos Property (NFSSDK_NFSClient Class)

Contains a subsecond value associated with this file's CreationTime .

Object Oriented Interface

public function getFileCreationTimeNanos();

Procedural Interface

nfssdk_nfsclient_get($res, 6 );

Default Value

0

Remarks

Contains a subsecond value associated with this file's FileCreationTime.

This property is read-only and not available at design time.

Data Type

Integer

FileType Property (NFSSDK_NFSClient Class)

The type of file.

Object Oriented Interface

public function getFileType();

Procedural Interface

nfssdk_nfsclient_get($res, 7 );

Possible Values

NFSCLIENT_FILETYPE_REG(1), 
NFSCLIENT_FILETYPE_DIR(2),
NFSCLIENT_FILETYPE_BLK(3),
NFSCLIENT_FILETYPE_CHR(4),
NFSCLIENT_FILETYPE_LNK(5),
NFSCLIENT_FILETYPE_SOCK(6),
NFSCLIENT_FILETYPE_FIFO(7),
NFSCLIENT_FILETYPE_ATTRDIR(8),
NFSCLIENT_FILETYPE_NAMEDATTR(9)

Default Value

0

Remarks

The type of file. FileType may be one of the following values:

1 (nfsREG - default)A regular file.
2 (NFS4DIR)A directory.
3 (NF4BLK)The file is a block device special file.
4 (NF4CHR)The file type is a character device special file.
5 (NF4LNK)The file type is a symbolic link.
6 (NF4SOCK)The file handle is a named socket special file.
7 (NF4FIFO)The file handle is a fifo special file.
8 (NF4ATTRDIR)The file handle is a named attribute directory.
9 (NF4NAMEDATTR)The file handle is a named attribute.

This property is read-only and not available at design time.

Data Type

Integer

FileIsDir Property (NFSSDK_NFSClient Class)

Specifies whether or not the file represented by these attributes is a directory.

Object Oriented Interface

public function getFileIsDir();

Procedural Interface

nfssdk_nfsclient_get($res, 8 );

Default Value

false

Remarks

Specifies whether or not the file represented by these attributes is a directory.

This property is read-only and not available at design time.

Data Type

Boolean

FileIsSymlink Property (NFSSDK_NFSClient Class)

Specifies whether or not the file or directory represented by these attributes is a symbolic link.

public function getFileIsSymlink();
nfssdk_nfsclient_get($res, 9 );

false

Specifies whether or not the file or directory represented by these attributes is a symbolic link.

This property is read-only and not available at design time.

Boolean

FileLinkCount Property (NFSSDK_NFSClient Class)

Number of hard links to this object.

Object Oriented Interface

public function getFileLinkCount();

Procedural Interface

nfssdk_nfsclient_get($res, 10 );

Default Value

0

Remarks

Number of hard links to this object.

This property is read-only and not available at design time.

Data Type

Integer

FileMIMEType Property (NFSSDK_NFSClient Class)

Specifies a value that can be used in the Content-Type header for a MIME entity part containing this file.

Object Oriented Interface

public function getFileMIMEType();

Procedural Interface

nfssdk_nfsclient_get($res, 11 );

Default Value

''

Remarks

Specifies a value that can be used in the Content-Type header for a MIME entity part containing this file.

This property is read-only and not available at design time.

Data Type

String

FileMode Property (NFSSDK_NFSClient Class)

Mode of a file.

Object Oriented Interface

public function getFileMode();
public function setFileMode($value);

Procedural Interface

nfssdk_nfsclient_get($res, 12 );
nfssdk_nfsclient_set($res, 12, $value );

Default Value

0

Remarks

Mode of a file

This property is not available at design time.

Data Type

Integer

FileModifiedTime Property (NFSSDK_NFSClient Class)

Specifies the number of seconds since 12:00:00 AM, January 1, 1970, that this file was last modified.

Object Oriented Interface

public function getFileModifiedTime();
public function setFileModifiedTime($value);

Procedural Interface

nfssdk_nfsclient_get($res, 13 );
nfssdk_nfsclient_set($res, 13, $value );

Default Value

0

Remarks

Specifies the number of seconds since 12:00:00 AM, January 1, 1970, that this file was last modified.

This property is not available at design time.

Data Type

Long64

FileModifiedTimeNanos Property (NFSSDK_NFSClient Class)

Includes a subsecond value associated with this file's ModifiedTime .

Object Oriented Interface

public function getFileModifiedTimeNanos();
public function setFileModifiedTimeNanos($value);

Procedural Interface

nfssdk_nfsclient_get($res, 14 );
nfssdk_nfsclient_set($res, 14, $value );

Default Value

0

Remarks

Includes a subsecond value associated with this file's FileModifiedTime.

This property is not available at design time.

Data Type

Integer

FileOwnerGroupId Property (NFSSDK_NFSClient Class)

The string name of the group ownership of this object.

Object Oriented Interface

public function getFileOwnerGroupId();
public function setFileOwnerGroupId($value);

Procedural Interface

nfssdk_nfsclient_get($res, 15 );
nfssdk_nfsclient_set($res, 15, $value );

Default Value

''

Remarks

The string name of the group ownership of this object.

This property is not available at design time.

Data Type

String

FileOwnerId Property (NFSSDK_NFSClient Class)

The string name of the owner of this object.

Object Oriented Interface

public function getFileOwnerId();
public function setFileOwnerId($value);

Procedural Interface

nfssdk_nfsclient_get($res, 16 );
nfssdk_nfsclient_set($res, 16, $value );

Default Value

''

Remarks

The string name of the owner of this object.

This property is not available at design time.

Data Type

String

FileSize Property (NFSSDK_NFSClient Class)

Specifies the total size, in bytes, of this file.

Object Oriented Interface

public function getFileSize();
public function setFileSize($value);

Procedural Interface

nfssdk_nfsclient_get($res, 17 );
nfssdk_nfsclient_set($res, 17, $value );

Default Value

0

Remarks

Specifies the total size, in bytes, of this file.

This property is not available at design time.

Data Type

Long64

FirewallAutoDetect Property (NFSSDK_NFSClient Class)

Whether to automatically detect and use firewall system settings, if available.

Object Oriented Interface

public function getFirewallAutoDetect();
public function setFirewallAutoDetect($value);

Procedural Interface

nfssdk_nfsclient_get($res, 18 );
nfssdk_nfsclient_set($res, 18, $value );

Default Value

false

Remarks

Whether to automatically detect and use firewall system settings, if available.

Data Type

Boolean

FirewallType Property (NFSSDK_NFSClient Class)

The type of firewall to connect through.

Object Oriented Interface

public function getFirewallType();
public function setFirewallType($value);

Procedural Interface

nfssdk_nfsclient_get($res, 19 );
nfssdk_nfsclient_set($res, 19, $value );

Possible Values

NFSCLIENT_FIREWALLTYPE_NONE(0), 
NFSCLIENT_FIREWALLTYPE_TUNNEL(1),
NFSCLIENT_FIREWALLTYPE_SOCKS4(2),
NFSCLIENT_FIREWALLTYPE_SOCKS5(3),
NFSCLIENT_FIREWALLTYPE_SOCKS4A(10)

Default Value

0

Remarks

The type of firewall to connect through. The applicable values are as follows:

fwNone (0)No firewall (default setting).
fwTunnel (1)Connect through a tunneling proxy. FirewallPort is set to 80.
fwSOCKS4 (2)Connect through a SOCKS4 Proxy. FirewallPort is set to 1080.
fwSOCKS5 (3)Connect through a SOCKS5 Proxy. FirewallPort is set to 1080.
fwSOCKS4A (10)Connect through a SOCKS4A Proxy. FirewallPort is set to 1080.

Data Type

Integer

FirewallHost Property (NFSSDK_NFSClient Class)

The name or IP address of the firewall (optional).

Object Oriented Interface

public function getFirewallHost();
public function setFirewallHost($value);

Procedural Interface

nfssdk_nfsclient_get($res, 20 );
nfssdk_nfsclient_set($res, 20, $value );

Default Value

''

Remarks

The name or IP address of the firewall (optional). If a FirewallHost is given, the requested connections will be authenticated through the specified firewall when connecting.

If this property is set to a Domain Name, a DNS request is initiated. Upon successful termination of the request, this property is set to the corresponding address. If the search is not successful, the class fails with an error.

Data Type

String

FirewallPassword Property (NFSSDK_NFSClient Class)

A password if authentication is to be used when connecting through the firewall.

Object Oriented Interface

public function getFirewallPassword();
public function setFirewallPassword($value);

Procedural Interface

nfssdk_nfsclient_get($res, 21 );
nfssdk_nfsclient_set($res, 21, $value );

Default Value

''

Remarks

A password if authentication is to be used when connecting through the firewall. If FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, the class fails with an error.

Data Type

String

FirewallPort Property (NFSSDK_NFSClient Class)

The Transmission Control Protocol (TCP) port for the firewall Host .

Object Oriented Interface

public function getFirewallPort();
public function setFirewallPort($value);

Procedural Interface

nfssdk_nfsclient_get($res, 22 );
nfssdk_nfsclient_set($res, 22, $value );

Default Value

0

Remarks

The Transmission Control Protocol (TCP) port for the firewall FirewallHost. See the description of the FirewallHost property for details.

Note: This property is set automatically when FirewallType is set to a valid value. See the description of the FirewallType property for details.

Data Type

Integer

FirewallUser Property (NFSSDK_NFSClient Class)

A username if authentication is to be used when connecting through a firewall.

Object Oriented Interface

public function getFirewallUser();
public function setFirewallUser($value);

Procedural Interface

nfssdk_nfsclient_get($res, 23 );
nfssdk_nfsclient_set($res, 23, $value );

Default Value

''

Remarks

A username if authentication is to be used when connecting through a firewall. If FirewallHost is specified, this property and the FirewallPassword property are used to connect and authenticate to the given Firewall. If the authentication fails, the class fails with an error.

Data Type

String

KDCHost Property (NFSSDK_NFSClient Class)

Specifies domain name or IP address of the Key Distribution Center (KDC).

Object Oriented Interface

public function getKDCHost();
public function setKDCHost($value);

Procedural Interface

nfssdk_nfsclient_get($res, 24 );
nfssdk_nfsclient_set($res, 24, $value );

Default Value

''

Remarks

This property specifies the domain name or IP address of the Key Distribution Center (KDC).

If this property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, this property is set to the corresponding address. If the search is not successful, an error is returned.

Note that this property is only applicable when SecurityMechanism is set to krb5, krb5i, or krb5p.

Data Type

String

KDCPort Property (NFSSDK_NFSClient Class)

Specifies the port for the Key Distribution Center (KDC).

Object Oriented Interface

public function getKDCPort();
public function setKDCPort($value);

Procedural Interface

nfssdk_nfsclient_get($res, 25 );
nfssdk_nfsclient_set($res, 25, $value );

Default Value

88

Remarks

This property specifies the port for the Key Distribution Center (KDC). The default value is 88.

Note that this property is only applicable when SecurityMechanism is set to krb5, krb5i, or krb5p.

Data Type

Integer

KeytabFile Property (NFSSDK_NFSClient Class)

Specifies the path to the Kerberos Keytab file.

Object Oriented Interface

public function getKeytabFile();
public function setKeytabFile($value);

Procedural Interface

nfssdk_nfsclient_get($res, 26 );
nfssdk_nfsclient_set($res, 26, $value );

Default Value

''

Remarks

This property specifies the path to a Kerberos Keytab file.

If specified, the credentials for a specific User are read from this file, assuming an entry for the user exists in the file. The Password should not be specified if using a Keytab file.

Note that this property is only applicable when SecurityMechanism is set to krb5, krb5i, or krb5p.

Data Type

String

LocalFile Property (NFSSDK_NFSClient Class)

This is the path to a local file for download or upload. If the file exists, it is overwritten.

Object Oriented Interface

public function getLocalFile();
public function setLocalFile($value);

Procedural Interface

nfssdk_nfsclient_get($res, 27 );
nfssdk_nfsclient_set($res, 27, $value );

Default Value

''

Remarks

This property is used by the Upload and Download methods to specify the path to a local file to be downloaded or uploaded. See the method descriptions for more information.

Example (Setting LocalFile)

// Download remotefile.txt to C:\\localfile.txt component.LocalFile = "C:\\localfile.txt"; component.RemoteFile = "remotefile.txt"; component.Download(); // Upload C:\\localfile2.txt to folder/remotefile2.txt component.LocalFile = "C:\\localfile2.txt"; component.RemoteFile = "folder/remotefile2.txt"; component.Upload();

Data Type

String

LocalHost Property (NFSSDK_NFSClient Class)

The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

Object Oriented Interface

public function getLocalHost();
public function setLocalHost($value);

Procedural Interface

nfssdk_nfsclient_get($res, 28 );
nfssdk_nfsclient_set($res, 28, $value );

Default Value

''

Remarks

This property contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.

In multihomed hosts (machines with more than one IP interface) setting LocalHost to the IP address of an interface will make the class initiate connections (or accept in the case of server classs) only through that interface. It is recommended to provide an IP address rather than a hostname when setting this property to ensure the desired interface is used.

If the class is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).

Note: LocalHost is not persistent. You must always set it in code, and never in the property window.

Data Type

String

LocalPort Property (NFSSDK_NFSClient Class)

The TCP port in the local host where the class binds.

Object Oriented Interface

public function getLocalPort();
public function setLocalPort($value);

Procedural Interface

nfssdk_nfsclient_get($res, 29 );
nfssdk_nfsclient_set($res, 29, $value );

Default Value

0

Remarks

This property must be set before a connection is attempted. It instructs the class to bind to a specific port (or communication endpoint) in the local machine.

Setting this property to 0 (default) enables the system to choose an open port at random. The chosen port will be returned by the LocalPort property after the connection is established.

LocalPort cannot be changed once a connection is made. Any attempt to set this property when a connection is active will generate an error.

This property is useful when trying to connect to services that require a trusted port on the client side.

Note: NFS exports may require that requests originate from a port less than 1024 (IPPORT_RESERVED). In this case, this property should be manually specified.

Data Type

Integer

Overwrite Property (NFSSDK_NFSClient Class)

This indicates whether the class should overwrite the local or remote file during a download or upload.

Object Oriented Interface

public function getOverwrite();
public function setOverwrite($value);

Procedural Interface

nfssdk_nfsclient_get($res, 30 );
nfssdk_nfsclient_set($res, 30, $value );

Default Value

false

Remarks

This property indicates whether the class should overwrite any local or remote files when calling Download, Upload, or CreateFile.

When uploading and Overwrite is false, an error will be thrown if the specified RemoteFile exists. When true, the RemoteFile will be overwritten.

When downloading and Overwrite is false, an error will be thrown if the specified LocalFile exists. When true, the LocalFile will be overwritten.

Data Type

Boolean

Password Property (NFSSDK_NFSClient Class)

Specifies the password of the User to authenticate.

Object Oriented Interface

public function getPassword();
public function setPassword($value);

Procedural Interface

nfssdk_nfsclient_get($res, 31 );
nfssdk_nfsclient_set($res, 31, $value );

Default Value

''

Remarks

This property specifies the password of the User to authenticate.

Note that this property is only applicable when SecurityMechanism is set to krb5, krb5i, or krb5p.

Data Type

String

RemoteFile Property (NFSSDK_NFSClient Class)

This is the name of the remote file for uploading, downloading, and performing other operations.

Object Oriented Interface

public function getRemoteFile();
public function setRemoteFile($value);

Procedural Interface

nfssdk_nfsclient_get($res, 32 );
nfssdk_nfsclient_set($res, 32, $value );

Default Value

''

Remarks

This property contains the name of the remote file to be uploaded or downloaded and is either an absolute file path or a relative path based on the remote path set by calling ChangeRemotePath.

A number of methods use RemoteFile as an argument.

Example 1. Setting RemoteFile:

component.LocalFile = "C:\\localfile.txt"; component.RemoteFile = "remotefile.txt"; component.Download(); component.LocalFile = "C:\\localfile2.txt"; component.RemoteFile = "folder/remotefile2.txt"; component.Download();

Note: This property will also act as a file mask when calling ListDirectory.

Example 2. Using RemoteFile as a file mask: component.RemoteFile = "*.txt" component.ListDirectory()

The following special characters are supported for pattern matching:

? Any single character.
* Any characters or no characters (e.g., C*t matches Cat, Cot, Coast, Ct).
[,-] A range of characters (e.g., [a-z], [a], [0-9], [0-9,a-d,f,r-z]).
\ The slash is ignored and exact matching is performed on the next character.

If these characters need to be used as a literal in a pattern, then they must be escaped by surrounding them with brackets []. Note: "]" and "-" do not need to be escaped. See below for the escape sequences:

CharacterEscape Sequence
? [?]
* [*]
[ [[]
\ [\]

For example, to match the value [Something].txt, specify the pattern [[]Something].txt.

Data Type

String

RemoteHost Property (NFSSDK_NFSClient Class)

Specifies the address of the NFS server.

Object Oriented Interface

public function getRemoteHost();
public function setRemoteHost($value);

Procedural Interface

nfssdk_nfsclient_get($res, 33 );
nfssdk_nfsclient_set($res, 33, $value );

Default Value

''

Remarks

This property specifies the IP address (IP number in dotted internet format) or the domain name of the NFS server. It is set before a connection is attempted and should not be changed once a connection is established.

Data Type

String

RemotePath Property (NFSSDK_NFSClient Class)

Specifies the current path in the NFS server.

Object Oriented Interface

public function getRemotePath();

Procedural Interface

nfssdk_nfsclient_get($res, 34 );

Default Value

''

Remarks

This property specifies the current working directory on the NFS server. The ChangeRemotePath method can be used to change the working directory to an absolute path or to a relative path with respect to the current value of RemotePath.

Example. Changing Directory:

component.RemoteHost = "nfs.server.net"; component.RemotePort = 2049; component.Connect(); component.ChangeRemotePath("/home/user"); Console.WriteLine(component.RemotePath); // Outputs "/home/user"

This property is read-only.

Data Type

String

RemotePort Property (NFSSDK_NFSClient Class)

Specifies the port the NFS server is listening on.

Object Oriented Interface

public function getRemotePort();
public function setRemotePort($value);

Procedural Interface

nfssdk_nfsclient_get($res, 35 );
nfssdk_nfsclient_set($res, 35, $value );

Default Value

2049

Remarks

This property specifies the port the NFS server is listening on (i.e., the port the class will connect to).By default, this value is 2049.

A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.

This property is not available at design time.

Data Type

Integer

RPCGid Property (NFSSDK_NFSClient Class)

Specifies the group identifier (GID) associated with requests during RPC system authentication.

Object Oriented Interface

public function getRPCGid();
public function setRPCGid($value);

Procedural Interface

nfssdk_nfsclient_get($res, 36 );
nfssdk_nfsclient_set($res, 36, $value );

Default Value

0

Remarks

This property specifies the group identifier (GID) associated with requests during RPC system authentication (AUTH_SYS).

The specified GID will be sent in all outgoing requests in order to identify the relevant primary group of the user making the request. The user can be identified by the RPCUid property.

Note this property is only applicable when SecurityMechanism is set to sys.

Data Type

Integer

RPCUid Property (NFSSDK_NFSClient Class)

Specifies the user identifier (UID) associated with requests during RPC system authentication.

Object Oriented Interface

public function getRPCUid();
public function setRPCUid($value);

Procedural Interface

nfssdk_nfsclient_get($res, 37 );
nfssdk_nfsclient_set($res, 37, $value );

Default Value

0

Remarks

This property specifies the user identifier (UID) associated with requests during RPC system authentication (AUTH_SYS).

The specified UID will be sent in all outgoing requests in order to identify the user making the request.

Note this property is only applicable when SecurityMechanism is set to sys.

Data Type

Integer

SecurityMechanism Property (NFSSDK_NFSClient Class)

Specifies the RPC security mechanism the client should use when connecting to the NFS Server.

Object Oriented Interface

public function getSecurityMechanism();
public function setSecurityMechanism($value);

Procedural Interface

nfssdk_nfsclient_get($res, 38 );
nfssdk_nfsclient_set($res, 38, $value );

Default Value

'sys'

Remarks

This property specifies the RPC security mechanism the client should use when connecting to the NFS server.

This property may be set to one of the following mechanisms:

MechanismDescription
noneNo authentication is required to establish a connection to the server (AUTH_NONE or AUTH_NULL).
sysSystem authentication is required to establish a connection to the server (AUTH_SYS or AUTH_UNIX).
krb5Kerberos v5 with client authentication only.
krb5iKerberos v5 with client authentication and integrity protection.
krb5pKerberos v5 with client authentication, integrity protection, and encryption.

By default, this property is set to sys, and only system authentication is supported. When set to sys, the following properties may be set to specify the UID and GID the class should perform the request as:

Kerberos Security Mechanisms

It is important to note the differences between the listed Kerberos security mechanisms. If krb5 is utilized, Kerberos will only be used to perform client authentication.

If krb5i is utilized, Kerberos will be used to perform client authentication and integrity protection, ensuring that incoming and outgoing packets are untampered. However, packets remain unencrypted, making sensitive data potentially visible to anyone monitoring the network.

If krb5p is utilized, Kerberos will be used to perform client authentication, integrity protection, and packet encryption, making this the most secure option.

If the security mechanism is set to any of the Kerberos security mechanisms, the following properties must also be set accordingly:

For example, connecting with a Kerberos security mechanism may look like:

// Configure general settings nfsclient.RemoteHost = "10.0.1.223"; nfsclient.RemotePort = 2049; nfsclient.SecurityMechanism = "krb5p"; // Configure kerberos settings nfsclient.KDCHost = "10.0.1.226"; nfsclient.User = "nfsclient@EXAMPLE.COM"; nfsclient.SPN = "nfs/nfs-server.example.com"; nfsclient.KeytabFile = "C:\\nfsclient.keytab"; // alternative to 'Password' nfsclient.Connect();

Data Type

String

SPN Property (NFSSDK_NFSClient Class)

Specifies the Service Principal Name (SPN).

Object Oriented Interface

public function getSPN();
public function setSPN($value);

Procedural Interface

nfssdk_nfsclient_get($res, 39 );
nfssdk_nfsclient_set($res, 39, $value );

Default Value

''

Remarks

This property specifies the Service Principal Name (SPN) that the User is attempting to access. This should be set to the SPN of the remote NFS Server, if applicable.

Note that this property is only applicable when SecurityMechanism is set to krb5, krb5i, or krb5p.

Data Type

String

StartByte Property (NFSSDK_NFSClient Class)

The offset in bytes at which to begin the Upload or Download.

Object Oriented Interface

public function getStartByte();
public function setStartByte($value);

Procedural Interface

nfssdk_nfsclient_get($res, 40 );
nfssdk_nfsclient_set($res, 40, $value );

Default Value

0

Remarks

The StartByte property is used by the Upload and Download methods to determine at what offset to begin the transfer. This allows for resuming both uploads and downloads. The value of this property is reset to 0 after a successful transfer.

When downloading a file, this property specifies both the starting position in the RemoteFile to read from, as well as the starting position in the LocalFile (or stream, if using SetDownloadStream) to write to.

When uploading a file, this property specifies both the starting position in the LocalFile (or stream, if using SetUploadStream) to read from, as well as the starting position in the RemoteFile to write to.

Please see below for a simple example of resuming an upload:

long bytesTransferred = 0; component.OnTransfer += (o, e) => { bytesTransferred = e.BytesTransferred; }; component.LocalFile = "C:\nfs\test.txt"; component.RemoteFile = "test.txt"; bool uploadSuccessful = false; int maxRetries = 5; int retryCount = 0; while (!uploadSuccessful) { try { component.StartByte = bytesTransferred; // 0 initially, updated by Transfer event as necessary component.Upload(); uploadSuccessful = true; } catch (NFSSDKException ex) { retryCount++; if (retryCount >= maxRetries) { Console.WriteLine("Max retry attempts reached. Upload failed."); throw ex; } } }

Data Type

Long64

Timeout Property (NFSSDK_NFSClient Class)

This property includes the timeout for the class.

Object Oriented Interface

public function getTimeout();
public function setTimeout($value);

Procedural Interface

nfssdk_nfsclient_get($res, 41 );
nfssdk_nfsclient_set($res, 41, $value );

Default Value

60

Remarks

If the Timeout property is set to 0, all operations return immediately, potentially failing with a WOULDBLOCK error if data cannot be sent immediately.

If Timeout is set to a positive value, data is sent in a blocking manner and the class will wait for the operation to complete before returning control. The class will handle any potential WOULDBLOCK errors internally and automatically retry the operation for a maximum of Timeout seconds.

The class will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not freeze and remains responsive.

If Timeout expires, and the operation is not yet complete, the class fails with an error.

Note: By default, all timeouts are inactivity timeouts, that is, the timeout period is extended by Timeout seconds when any amount of data is successfully sent or received.

The default value for the Timeout property is 60 seconds.

Data Type

Integer

User Property (NFSSDK_NFSClient Class)

Specifies the name and domain of the user to authenticate.

Object Oriented Interface

public function getUser();
public function setUser($value);

Procedural Interface

nfssdk_nfsclient_get($res, 42 );
nfssdk_nfsclient_set($res, 42, $value );

Default Value

''

Remarks

This property specifies the name and realm/domain of the user to authenticate.

The value specified must be in one of the following formats:

  • user@domain
  • domain/user

Note that this property is only applicable when SecurityMechanism is set to krb5, krb5i, or krb5p.

Data Type

String

Abort Method (NFSSDK_NFSClient Class)

Aborts the current upload or download.

Object Oriented Interface

public function doAbort();

Procedural Interface

nfssdk_nfsclient_do_abort($res);

Remarks

This method is used to abort the current upload or download.

Append Method (NFSSDK_NFSClient Class)

Appends data from LocalFile to a remote file RemoteFile on a NFS server.

Object Oriented Interface

public function doAppend();

Procedural Interface

nfssdk_nfsclient_do_append($res);

Remarks

This method is similar to the Upload method, but the local file specified by LocalFile is appended to RemoteFile on the server as opposed to replacing it as with the Upload method. RemoteFile is either an absolute path on the server or a path relative to RemotePath. The server will create a file with that name if it does not already exist (similar to upload).

ChangeRemotePath Method (NFSSDK_NFSClient Class)

Changes the current path on the server.

Object Oriented Interface

public function doChangeRemotePath($remotepath);

Procedural Interface

nfssdk_nfsclient_do_changeremotepath($res, $remotepath);

Remarks

This method changes the current path on the server to the specified RemotePath parameter. When called, the class will issue a command to the server to change the directory. The RemotePath parameter may hold an absolute or relative path.

The current path on the server can be found by querying the RemotePath property.

Absolute Paths

If the path begins with a /, it is considered an absolute path and must specify the entire path from the root of the server. For example:

component.ChangeRemotePath("/home/testuser/myfolder");

Relative Paths

If the path does not begin with a /, it is considered a relative path and is resolved in relation to the current directory. For instance, a value of myfolder will indicate a subfolder of the current directory. The special value .. refers to the parent directory of the current path. For example:

//Change to the 'myfolder' sub-directory component.ChangeRemotePath("myfolder"); //Navigate up two levels and then into the 'another/folder' path. component.ChangeRemotePath("../../another/folder");

CheckFileExists Method (NFSSDK_NFSClient Class)

Checks whether the file specified by RemoteFile exists on the server.

Object Oriented Interface

public function doCheckFileExists();

Procedural Interface

nfssdk_nfsclient_do_checkfileexists($res);

Remarks

This method checks whether the file specified by RemoteFile exists on the server. If the file exists, this method returns true, otherwise it returns false. RemoteFile must be specified before calling this method.

The RemoteFile can either specify the absolute path to the file, or a relative path based on the current working directory (indicated by the RemotePath property). For instance:

// Relative Path component.ChangeRemotePath("/home/testuser/myfolder"); component.RemoteFile = "test.txt"; // Checks for test.txt in /home/testuser/myfolder if(component.CheckFileExists()) { component.Download(); } // Absolute Path component.RemoteFile = "/home/test/test.txt"; // Checks for test.txt in /home/test if(component.CheckFileExists()) { component.Download(); }

Config Method (NFSSDK_NFSClient Class)

Sets or retrieves a configuration setting.

Object Oriented Interface

public function doConfig($configurationstring);

Procedural Interface

nfssdk_nfsclient_do_config($res, $configurationstring);

Remarks

Config is a generic method available in every class. It is used to set and retrieve configuration settings for the class.

These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these internal properties is provided through the Config method.

To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.

Connect Method (NFSSDK_NFSClient Class)

This method connects to the NFS server.

Object Oriented Interface

public function doConnect();

Procedural Interface

nfssdk_nfsclient_do_connect($res);

Remarks

This method establishes a connection with the NFS server specified by RemoteHost and RemotePort.

Prior to calling this method, the SecurityMechanism should be set appropriately, along with properties relevant to the specified mechanism. For example:

component.RemoteHost = "10.0.1.67"; component.RemotePort = 2049; component.Connect();

CreateFile Method (NFSSDK_NFSClient Class)

Creates a file on the NFS server.

Object Oriented Interface

public function doCreateFile($filename);

Procedural Interface

nfssdk_nfsclient_do_createfile($res, $filename);

Remarks

This method creates an empty file on the server with the name specified by the FileName parameter.

If the specified FileName already exists, and Overwrite is false, an error will be thrown.

To upload a file with content, use Upload instead.

CreateLink Method (NFSSDK_NFSClient Class)

Creates a hard link or symbolic link on the server.

public function doCreateLink($linkname, $linktarget, $linktype);
nfssdk_nfsclient_do_createlink($res, $linkname, $linktarget, $linktype);

This method is used to create a hard link or symbolic link on the server.

The LinkName parameter is the name of the link to create, and is either an absolute path on the server or a path relative to RemotePath.

The LinkTarget parameter specifies the target of the link.

The LinkType parameter indicates what type of link the class should attempt to create. Possible values are 0 or 1.

If specified as 0, the class will attempt to create a symbolic link pointing to the data (typically a file name) specified by the LinkTarget parameter.

If specified as 1, the class will attempt to create a hard link pointing to the file name specified by the LinkTarget parameter. Note that in this case, the LinkTarget is either an absolute path on the server or a path relative to RemotePath. Please see below for a simple example.

nfs.ChangeRemotePath("/nfs"); // Create symlink.txt in /nfs pointing to existing_file.txt in the same directory nfs.CreateLink("symlink.txt", "existing_file.txt", 0); // Create hardlink.txt in /nfs pointing to existing_file.txt in the same directory nfs.CreateLink("hardlink.txt", "existing_file.txt", 1);

DeleteFile Method (NFSSDK_NFSClient Class)

This method removes a file specified by FileName from the server.

Object Oriented Interface

public function doDeleteFile($filename);

Procedural Interface

nfssdk_nfsclient_do_deletefile($res, $filename);

Remarks

This method is used to remove a file specified by FileName from the server. The remote file or directory specified by FileName is deleted.

The FileName parameter is either an absolute path on the server, or a path relative to remote path set by ChangeRemotePath. For example:

// Delete test.txt in /home/test directory component.ChangeRemotePath("/home/test"); component.DeleteFile("test.txt"); // Alternatively... component.DeleteFile("/home/test/test.txt");

Disconnect Method (NFSSDK_NFSClient Class)

This method disconnects from the NFS server.

Object Oriented Interface

public function doDisconnect();

Procedural Interface

nfssdk_nfsclient_do_disconnect($res);

Remarks

This method is used to disconnect from the NFS server.

DoEvents Method (NFSSDK_NFSClient Class)

This method processes events from the internal message queue.

Object Oriented Interface

public function doEvents();

Procedural Interface

nfssdk_nfsclient_do_doevents($res);

Remarks

The method checks for events to process, such as incoming data, and fires corresponding events as necessary. If there are no events to process, the method waits for a time specified by the SelectWaitMillis configuration setting before returning.

Windows: By default, the server socket uses Windows messages, and DoEvents dispatches Windows messages internally. It is not necessary to call DoEvents from Windows GUI applications as these applications have an internal message dispatch loop. When called, this method must be called in the same thread or task in which the StartListening and StopListening methods are called.

To avoid using Windows messages and a dispatch loop, set UseWindowsMessages to false. The application still needs to call this DoEvents method to let the class handle socket updates, but when Windows messages are not used, DoEvents and StopListening may be called from a separate thread or task.

Linux: The method may be called from any worker thread, and events will fire in this thread.

macOS: In GUI applications, it is not necessary to call this method as the class registers itself in the main message loop. In other applications, the method may be called from any worker thread, and events will fire in this thread.

Download Method (NFSSDK_NFSClient Class)

This method downloads a remote file from the NFS server.

Object Oriented Interface

public function doDownload();

Procedural Interface

nfssdk_nfsclient_do_download($res);

Remarks

This method is used to download a remote file, specified by RemoteFile, from the NFS server.

The LocalFile property can be used to specify a local file to download the specified remote file to. If the LocalFile already exists and Overwrite is false, an error will occur.

Alternatively, the SetDownloadStream method can be called to download the file contents to the specified stream. In this case, calling SetDownloadStream will automatically reset the value of LocalFile.

As an alternative to setting LocalFile or calling SetDownloadStream, the downloaded file contents are also available in the Transfer event. Note that the downloaded data is always available via Transfer, regardless of whether the data is downloaded to a stream or file (or neither).

For example:

// Using LocalFile component.RemoteFile = "/home/test/test.txt"; component.LocalFile = "C:\\nfsdir\\test.txt"; component.Download(); // Using SetDownloadStream FileStream fs = new FileStream("C:\\nfsdir\\test.txt", FileMode.Open); component.RemoteFile = "/home/test/test.txt"; component.SetDownloadStream(fs); component.Download();

DownloadRange Method (NFSSDK_NFSClient Class)

This method downloads a specific segment of a remote file from a NFS server.

Object Oriented Interface

public function doDownloadRange($path, $filename, $startbyte, $count, $buffer);

Procedural Interface

nfssdk_nfsclient_do_downloadrange($res, $path, $filename, $startbyte, $count, $buffer);

Remarks

This method is used to download a specific segment of a remote file specified by Path and FileName.

StartByte is the offset (in bytes) relative to the beginning of the file from where to start reading, and Count is the number of bytes to read into the specified Buffer.

This functionality is particularly useful for efficient management of large files and targeted data retrieval within them. This method will return the total number of bytes read into the buffer.

Note: If the requested range extends beyond the end of the file, only the available bytes will be returned.

For example:

// E.g., downloading first 5 bytes of file byte[] downloadBuffer = new byte[5]; component.DownloadRange("/home/test", "test.txt", 0, downloadBuffer.Length, downloadBuffer);

ListDirectory Method (NFSSDK_NFSClient Class)

This method lists the current working directory on the NFS server.

Object Oriented Interface

public function doListDirectory();

Procedural Interface

nfssdk_nfsclient_do_listdirectory($res);

Remarks

This method is used to list the current working directory on the NFS server, as indicated by the current RemotePath.

The DirList event will fire for each entry in the current directory. The RemoteFile property may be used to specify a file mask for filtering the entries returned via DirList.

For example:

// List all text files in /home/test component.OnDirList += (o, e) => { Console.WriteLine("Dir Entry: " + e.FileName); }; component.ChangeRemotePath("/home/test"); component.RemoteFile = "*.txt"; component.ListDirectory();

Note: Because RemoteFile acts as a file mask, to retrieve a complete directory listing RemoteFile should be set to an empty string (or a mask like "*").

The following special characters are supported for pattern matching:

? Any single character.
* Any characters or no characters (e.g., C*t matches Cat, Cot, Coast, Ct).
[,-] A range of characters (e.g., [a-z], [a], [0-9], [0-9,a-d,f,r-z]).
\ The slash is ignored and exact matching is performed on the next character.

If these characters need to be used as a literal in a pattern, then they must be escaped by surrounding them with brackets []. Note: "]" and "-" do not need to be escaped. See below for the escape sequences:

CharacterEscape Sequence
? [?]
* [*]
[ [[]
\ [\]

For example, to match the value [Something].txt, specify the pattern [[]Something].txt.

MakeDirectory Method (NFSSDK_NFSClient Class)

This method is used to create a directory on the NFS server.

Object Oriented Interface

public function doMakeDirectory($newdir);

Procedural Interface

nfssdk_nfsclient_do_makedirectory($res, $newdir);

Remarks

This method is used to create a directory with a path specified by NewDir on the NFS server.

NewDir is either an absolute path on the server, or a path relative to the RemotePath that is set by calling ChangeRemotePath.

QueryFileAttributes Method (NFSSDK_NFSClient Class)

This method queries the server for the file attributes of the specified RemoteFile .

Object Oriented Interface

public function doQueryFileAttributes();

Procedural Interface

nfssdk_nfsclient_do_queryfileattributes($res);

Remarks

This method is used to query the server for file attributes of the specified RemoteFile. After calling this method, the FileAttributes property will be populated with the values returned by the server.

To update attributes, modify the desired values in FileAttributes and call UpdateFileAttributes. Please see below for a simple example:

// First, query attributes component.RemoteFile = "/home/test/test.txt"; component.QueryFileAttributes(); // Update OwnerId and OwnerGroupId of file component.FileAttributes.OwnerId = "1000"; component.FileAttributes.OwnerGroupId = "1000"; component.UpdateFileAttributes();

ReadLink Method (NFSSDK_NFSClient Class)

Reads a symbolic link on the server.

public function doReadLink($linkname);
nfssdk_nfsclient_do_readlink($res, $linkname);

This method is used to read a symbolic link on the server.

The LinkName parameter specifies the name of the symbolic link, and is either an absolute path on the server or a path relative to RemotePath.

This method will return a byte array containing the contents of the symbolic link as stored on the server. In NFS v4.0, the contents of a symbolic link are treated as opaque (binary data) at the protocol level. The server simply stores this opaque data, and returns this to the client when requested, meaning it is up to the client to interpret the link data.

Most of the time, the opaque data will represent the file the symbolic link is pointing to relative to the position of the symbolic link, meaning it can be converted to a UTF8 string representing this file. The contents of the file should then be downloaded by setting RemoteFile (and possibly RemotePath) accordingly and calling Download.

Please see below for a simple example of reading the contents of a symbolic link, and reading the file pointed to by the symbolic link.

nfs.ChangeRemotePath("/nfs"); // Create symlink.txt in /nfs pointing to existing_file.txt in the same directory nfs.CreateLink("symlink.txt", "existing_file.txt", 0); // Read link byte[] linkData = nfs.ReadLink("symlink.txt"); string file = Encoding.UTF8.GetString(linkData); nfs.RemoteFile = file; nfs.LocalFile = "temp.txt"; nfs.Download();

RemoveDirectory Method (NFSSDK_NFSClient Class)

This removes a directory specified by DirName from the NFS server.

Object Oriented Interface

public function doRemoveDirectory($dirname);

Procedural Interface

nfssdk_nfsclient_do_removedirectory($res, $dirname);

Remarks

This method is used to remove a directory with path specified by DirName from the NFS server. DirName is either an absolute path on the server, or a path relative to the RemotePath that is set by calling ChangeRemotePath.

RenameFile Method (NFSSDK_NFSClient Class)

This changes the name of RemoteFile to NewName .

Object Oriented Interface

public function doRenameFile($newname);

Procedural Interface

nfssdk_nfsclient_do_renamefile($res, $newname);

Remarks

This method is used to change the name of a remote file, specified by RemoteFile, to NewName. RemoteFile and NewName are either absolute paths on the server, or a path relative to RemotePath that is set by calling ChangeRemotePath.

Reset Method (NFSSDK_NFSClient Class)

This method will reset the class.

Object Oriented Interface

public function doReset();

Procedural Interface

nfssdk_nfsclient_do_reset($res);

Remarks

This method will reset the class's properties to their default values.

UpdateFileAttributes Method (NFSSDK_NFSClient Class)

This method updates the FileAttributes for the current RemoteFile .

Object Oriented Interface

public function doUpdateFileAttributes();

Procedural Interface

nfssdk_nfsclient_do_updatefileattributes($res);

Remarks

This method is used to update the FileAttributes for the current RemoteFile. After calling this method, the class will send any set FileAttributes to the server.

For example:

// First, query attributes component.RemoteFile = "/home/test/test.txt"; component.QueryFileAttributes(); // Update OwnerId and OwnerGroupId of file component.FileAttributes.OwnerId = "1000"; component.FileAttributes.OwnerGroupId = "1000"; component.UpdateFileAttributes();

Upload Method (NFSSDK_NFSClient Class)

This method uploads a file to the NFS server.

Object Oriented Interface

public function doUpload();

Procedural Interface

nfssdk_nfsclient_do_upload($res);

Remarks

This method is used to upload a file to the NFS server.

The RemoteFile property is used to specify the remote location to upload the local data to. If the RemoteFile already exists and Overwrite is false, an error will occur while uploading.

The LocalFile property can be used to specify a local file to upload to the specified remote location.

Alternatively, the SetUploadStream method can be called to upload the contents of a given stream. In this case, calling SetUploadStream will automatically reset the value of LocalFile.

The uploaded data will be made available in the Transfer event. Please see below for a simple example.

// Using LocalFile component.LocalFile = "C:\\nfsdir\\test.txt"; component.RemoteFile = "/home/test/test.txt"; component.Upload(); // Using SetDownloadStream FileStream fs = new FileStream("C:\\nfsdir\\test.txt", FileMode.Open); component.SetUploadStream(fs); component.RemoteFile = "/home/test/test.txt"; component.Upload();

UploadRange Method (NFSSDK_NFSClient Class)

This method uploads a specific segment of data into a remote file on the NFS server.

Object Oriented Interface

public function doUploadRange($path, $filename, $startbyte, $count, $buffer);

Procedural Interface

nfssdk_nfsclient_do_uploadrange($res, $path, $filename, $startbyte, $count, $buffer);

Remarks

This method is used to upload a specific segment of data into a remote file specified by Path and FileName. Count bytes will be updated from the provided Buffer starting in the remote file at the StartByte offset.

This functionality enables precise control over the insertion of data into a remote file, allowing for targeted modifications, overwriting, or additions starting from a specific position within the file.

Note: If the offset specified is beyond the file length, empty bytes will be created between the last file byte and the uploaded buffer.

For example:

// E.g., appending data to EOF component.RemoteFile = "/home/test/test.txt"; component.QueryFileAttributes(); int startByte = component.FileAttributes.Size; byte[] buffer = Encoding.Default.GetBytes("Upload these bytes"); component.UploadRange("/home/test", "test.txt", startByte, buffer.Length, buffer);

Connected Event (NFSSDK_NFSClient Class)

Fired immediately after a connection completes (or fails).

Object Oriented Interface

public function fireConnected($param);

Procedural Interface

nfssdk_nfsclient_register_callback($res, 1, array($this, 'fireConnected'));

Parameter List

 'statuscode'
'description'

Remarks

If the connection is made normally, StatusCode is 0 and Description is "OK".

If the connection fails, StatusCode has the error code returned by the Transmission Control Protocol (TCP)/IP stack. Description contains a description of this code. The value of StatusCode is equal to the value of the error.

Please refer to the Error Codes section for more information.

DirList Event (NFSSDK_NFSClient Class)

This event fires when a directory entry is received.

Object Oriented Interface

public function fireDirList($param);

Procedural Interface

nfssdk_nfsclient_register_callback($res, 2, array($this, 'fireDirList'));

Parameter List

 'direntry'
'filename'
'isdir'
'filesize'
'filetime'
'issymlink'

Remarks

The DirList events are fired when a directory listing is received as a response to a ListDirectory call.

The StartTransfer and EndTransfer events mark the beginning and end of the event stream.

The DirEntry parameter contains the filename when ListDirectory is called and includes extended file information when ListDirectoryLong is called.

The class tries to fill out the FileName, IsDir, FileSize, and FileTime parameters when calling the ListDirectoryLong method. Except for FileName, these parameters are empty when a short "List Directory" is performed.

In Unix systems, the date is given in two types of formats: If the date is in the past 12 months the exact time is specified and the year is omitted. Otherwise, only the date and the year, but not hours or minutes, are given.

Disconnected Event (NFSSDK_NFSClient Class)

This event is fired when a connection is closed.

Object Oriented Interface

public function fireDisconnected($param);

Procedural Interface

nfssdk_nfsclient_register_callback($res, 3, array($this, 'fireDisconnected'));

Parameter List

 'statuscode'
'description'

Remarks

This event is fired when a connection is closed.

If the connection is broken normally, StatusCode is 0 and Description is "OK".

If the connection is broken for any other reason, StatusCode will be non-zero, and the Description parameter will contain a description of this code.

EndTransfer Event (NFSSDK_NFSClient Class)

This event is fired when a file finishes uploading or downloading.

Object Oriented Interface

public function fireEndTransfer($param);

Procedural Interface

nfssdk_nfsclient_register_callback($res, 4, array($this, 'fireEndTransfer'));

Parameter List

 'direction'

Remarks

This event is fired when a file is finished uploading or downloading.

This occurs when a file is finished transferring after calling Upload, UploadRange, Download, and DownloadRange.

The Direction parameter shows whether the client (0) or the server (1) is sending the data.

Error Event (NFSSDK_NFSClient Class)

Fired when information is available about errors during data delivery.

Object Oriented Interface

public function fireError($param);

Procedural Interface

nfssdk_nfsclient_register_callback($res, 5, array($this, 'fireError'));

Parameter List

 'errorcode'
'description'

Remarks

The Error event is fired in case of exceptional conditions during message processing. Normally the class fails with an error.

The ErrorCode parameter contains an error code, and the Description parameter contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the Error Codes section.

Log Event (NFSSDK_NFSClient Class)

This event is fired once for each log message.

Object Oriented Interface

public function fireLog($param);

Procedural Interface

nfssdk_nfsclient_register_callback($res, 6, array($this, 'fireLog'));

Parameter List

 'loglevel'
'message'
'logtype'

Remarks

This event fires once for each log message generated by the class. The verbosity is controlled by the LogLevel configuration.

LogLevel indicates the detail level of the message. Possible values are:

0 (None) No messages are logged.
1 (Info - Default) Informational events are logged.
2 (Verbose) Detailed data is logged.
3 (Debug) Debug data including all sent and received NFS operations are logged.

Message is the log message.

LogType identifies the type of log entry. Possible values are as follows:

  • NFS

StartTransfer Event (NFSSDK_NFSClient Class)

This event is fired when a file starts uploading or downloading.

Object Oriented Interface

public function fireStartTransfer($param);

Procedural Interface

nfssdk_nfsclient_register_callback($res, 7, array($this, 'fireStartTransfer'));

Parameter List

 'direction'

Remarks

This event is fired when a file starts uploading or downloading.

This occurs immediately before a file starts transferring after calling Upload, UploadRange, Download, and DownloadRange.

The Direction parameter shows whether the client (0) or the server (1) is sending the data.

Transfer Event (NFSSDK_NFSClient Class)

This event is fired during the file download or upload.

Object Oriented Interface

public function fireTransfer($param);

Procedural Interface

nfssdk_nfsclient_register_callback($res, 8, array($this, 'fireTransfer'));

Parameter List

 'direction'
'bytestransferred'
'percentdone'
'text'

Remarks

One or more Transfer events are fired during file transfer. The BytesTransferred parameter shows the number of bytes transferred since the beginning of the transfer.

Text contains the portion of the file data being delivered.

The Direction parameter shows whether the client (0) or the server (1) is sending the data.

The PercentDone parameter shows the progress of the transfer in the corresponding direction. If PercentDone can not be calculated the value will be -1.

Note: Events are not re-entrant. Performing time-consuming operations within this event will prevent it from firing again in a timely manner and may affect overall performance.

Config Settings (NFSClient Class)

The class accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these internal properties is provided through the Config method.

NfsClient Config Settings

AppendToLocalFile:   Whether to append downloaded files to a local file.

This config specifies whether to append downloaded files to a local file. By default, this is False. If set to True, the downloaded files will be appended to the file specified by LocalFile.

ClientIDSeek:   Specifies some identifier used when creating the client ID associated with the current connection.

This config is used to specify some identifier used when creating the client ID associated with the current connection. By default, this is set to an empty string.

To clarify, when connecting to a server, the client must send a client ID to identify itself. The class automatically creates an ID based on the LocalHost, LocalPort, RemoteHost, and RemotePort, as recommended by RFC 7530.

This could cause problems on the server-side if multiple clients are running on the exact same machine, or by chance have the same client ID. If this is the case, this config can be set to some unique string identifier for the client, which will be appended to the existing client ID, to ensure no server-side collisions.

DirCountSize:   Specifies the maximum number of bytes that may be returned in a single READDIR request.

This config specifies the maximum number of bytes that may be returned in a single READDIR request. By default, this config is set to 4096 bytes.

When calling ListDirectory, this config is utilized to inform the server of the maximum number of bytes that should be returned in a single READDIR request.

Larger values will result in fewer READDIR requests for the given ListDirectory operation, but the READDIR results from the server-side could potentially be much larger. Smaller values will result in smaller READDIR responses from the server, but increase the frequency of READDIR requests to the server.

FileTimeFormat:   Specifies the format to use when returning filetime strings.

This config specifies the format to use when returning filetime strings. If specified, the class will use this value to format the filetime string returned through the DirList event. By default, the class will format the date as "MM/dd/yyyy HH:mm:ss".

MaxReadBytes:   Indicates the maximum number of bytes that will be returned in one READ operation.

This config indicates the maximum number of bytes that will be returned in one READ operation when downloading a file.

Note this config is read-only.

MaxWriteBytes:   Indicates the maximum number of bytes that will be written in one WRITE operation.

This config indicates the maximum number of bytes that will be written in one WRITE operation when uploading a file.

Note this config is read-only.

OpenOwner:   Specifies an opaque string representing the client when opening a file.

This config specifies an opaque string representing the client when opening a file (e.g., for reading or writing to the file). The server utilizes this value to manage OPEN requests from multiple clients.

By default, this config is an empty string. It is automatically assigned upon the clients first read or write operation (e.g., via Upload or Download). Upon the first read or write operation, the class sets this value to the number of milliseconds elapsed since the epoch (January 1, 1970 UTC), and it remains unchanged for the lifetime of the client. In most cases, it is not necessary to set this config.

RPCAuxiliaryGids:   Specifies the Auxiliary GIDs (or groups) the client is a part of.

This config is used to specify the Auxiliary GIDs (or groups) the client is a part, which will be utilized during RPC requests to the remote host.

This config must be specified as a comma-separated list of such GIDs, for example: 4,24,27,30,46,110,1000

RPCHostname:   Specifies the host (or machine) name of the client.

This config is used to specify the host (or machine) name of the client, which will be utilized during RPC requests to the remote host.

STMask:   Specifies the default file mode (or permission) bits to exclude when creating a file.

This config specifies the default file mode (or permission) bits to exclude when creating a file. This config is applicable when calling CreateFile, CreateLink, MakeDirectory, Upload, and UploadRange.

By default, this is set to the ORed value of S_IWGRP and S_IWOTH, meaning the new file will not include write permissions for the group or others. For reference, this config may be set to a combination of the following permission bits, as defined in the UNIX standard sys/stat.h header:

S_IRUSR0x100Read permission, owner.
S_IWUSR0x080Write permission, owner.
S_IXUSR0x040Execute permission, owner.
S_IRGRP0x020Read permission, group.
S_IWGRP0x010Write permission, group.
S_IXGRP0x008Execute permission, group.
S_IROTH0x004Read permission, others.
S_IWOTH0x002Write permission, others.
S_IXOTH0x001Execute permission, others.

For example, to deny write permissions only for others, you can set this like so:

int stMask = S_IWOTH; // 0x0002 component.Config("STMask=" + stMask); component.Remotefile = "remote.txt"; component.CreateFile();

UsePlatformKerberosAPI:   Whether to use the platform Kerberos API.

This config determines whether or not to use the platform Kerberos API when connecting (and assuming SecurityMechanism is set to krb5, krb5i, or krb5p). By default, the class does not rely on any platform APIs to perform Kerberos authentication, and this config is False. Use of the platform API may be enabled by setting this to True.

Note: This functionality is only available on Windows.

XAttrCountSize:   Specifies the maximum number of bytes that may be returned in a single LISTXATTRS request.

This config specifies the maximum number of data retrieved from the NFSServer when the client requests to list the XAttributes of a remoteFile.

Base Config Settings

BuildInfo:   Information about the product's build.

When queried, this setting will return a string containing information about the product's build.

CodePage:   The system code page used for Unicode to Multibyte translations.

The default code page is Unicode UTF-8 (65001).

The following is a list of valid code page identifiers:

IdentifierName
037IBM EBCDIC - U.S./Canada
437OEM - United States
500IBM EBCDIC - International
708Arabic - ASMO 708
709Arabic - ASMO 449+, BCON V4
710Arabic - Transparent Arabic
720Arabic - Transparent ASMO
737OEM - Greek (formerly 437G)
775OEM - Baltic
850OEM - Multilingual Latin I
852OEM - Latin II
855OEM - Cyrillic (primarily Russian)
857OEM - Turkish
858OEM - Multilingual Latin I + Euro symbol
860OEM - Portuguese
861OEM - Icelandic
862OEM - Hebrew
863OEM - Canadian-French
864OEM - Arabic
865OEM - Nordic
866OEM - Russian
869OEM - Modern Greek
870IBM EBCDIC - Multilingual/ROECE (Latin-2)
874ANSI/OEM - Thai (same as 28605, ISO 8859-15)
875IBM EBCDIC - Modern Greek
932ANSI/OEM - Japanese, Shift-JIS
936ANSI/OEM - Simplified Chinese (PRC, Singapore)
949ANSI/OEM - Korean (Unified Hangul Code)
950ANSI/OEM - Traditional Chinese (Taiwan; Hong Kong SAR, PRC)
1026IBM EBCDIC - Turkish (Latin-5)
1047IBM EBCDIC - Latin 1/Open System
1140IBM EBCDIC - U.S./Canada (037 + Euro symbol)
1141IBM EBCDIC - Germany (20273 + Euro symbol)
1142IBM EBCDIC - Denmark/Norway (20277 + Euro symbol)
1143IBM EBCDIC - Finland/Sweden (20278 + Euro symbol)
1144IBM EBCDIC - Italy (20280 + Euro symbol)
1145IBM EBCDIC - Latin America/Spain (20284 + Euro symbol)
1146IBM EBCDIC - United Kingdom (20285 + Euro symbol)
1147IBM EBCDIC - France (20297 + Euro symbol)
1148IBM EBCDIC - International (500 + Euro symbol)
1149IBM EBCDIC - Icelandic (20871 + Euro symbol)
1200Unicode UCS-2 Little-Endian (BMP of ISO 10646)
1201Unicode UCS-2 Big-Endian
1250ANSI - Central European
1251ANSI - Cyrillic
1252ANSI - Latin I
1253ANSI - Greek
1254ANSI - Turkish
1255ANSI - Hebrew
1256ANSI - Arabic
1257ANSI - Baltic
1258ANSI/OEM - Vietnamese
1361Korean (Johab)
10000MAC - Roman
10001MAC - Japanese
10002MAC - Traditional Chinese (Big5)
10003MAC - Korean
10004MAC - Arabic
10005MAC - Hebrew
10006MAC - Greek I
10007MAC - Cyrillic
10008MAC - Simplified Chinese (GB 2312)
10010MAC - Romania
10017MAC - Ukraine
10021MAC - Thai
10029MAC - Latin II
10079MAC - Icelandic
10081MAC - Turkish
10082MAC - Croatia
12000Unicode UCS-4 Little-Endian
12001Unicode UCS-4 Big-Endian
20000CNS - Taiwan
20001TCA - Taiwan
20002Eten - Taiwan
20003IBM5550 - Taiwan
20004TeleText - Taiwan
20005Wang - Taiwan
20105IA5 IRV International Alphabet No. 5 (7-bit)
20106IA5 German (7-bit)
20107IA5 Swedish (7-bit)
20108IA5 Norwegian (7-bit)
20127US-ASCII (7-bit)
20261T.61
20269ISO 6937 Non-Spacing Accent
20273IBM EBCDIC - Germany
20277IBM EBCDIC - Denmark/Norway
20278IBM EBCDIC - Finland/Sweden
20280IBM EBCDIC - Italy
20284IBM EBCDIC - Latin America/Spain
20285IBM EBCDIC - United Kingdom
20290IBM EBCDIC - Japanese Katakana Extended
20297IBM EBCDIC - France
20420IBM EBCDIC - Arabic
20423IBM EBCDIC - Greek
20424IBM EBCDIC - Hebrew
20833IBM EBCDIC - Korean Extended
20838IBM EBCDIC - Thai
20866Russian - KOI8-R
20871IBM EBCDIC - Icelandic
20880IBM EBCDIC - Cyrillic (Russian)
20905IBM EBCDIC - Turkish
20924IBM EBCDIC - Latin-1/Open System (1047 + Euro symbol)
20932JIS X 0208-1990 & 0121-1990
20936Simplified Chinese (GB2312)
21025IBM EBCDIC - Cyrillic (Serbian, Bulgarian)
21027Extended Alpha Lowercase
21866Ukrainian (KOI8-U)
28591ISO 8859-1 Latin I
28592ISO 8859-2 Central Europe
28593ISO 8859-3 Latin 3
28594ISO 8859-4 Baltic
28595ISO 8859-5 Cyrillic
28596ISO 8859-6 Arabic
28597ISO 8859-7 Greek
28598ISO 8859-8 Hebrew
28599ISO 8859-9 Latin 5
28605ISO 8859-15 Latin 9
29001Europa 3
38598ISO 8859-8 Hebrew
50220ISO 2022 Japanese with no halfwidth Katakana
50221ISO 2022 Japanese with halfwidth Katakana
50222ISO 2022 Japanese JIS X 0201-1989
50225ISO 2022 Korean
50227ISO 2022 Simplified Chinese
50229ISO 2022 Traditional Chinese
50930Japanese (Katakana) Extended
50931US/Canada and Japanese
50933Korean Extended and Korean
50935Simplified Chinese Extended and Simplified Chinese
50936Simplified Chinese
50937US/Canada and Traditional Chinese
50939Japanese (Latin) Extended and Japanese
51932EUC - Japanese
51936EUC - Simplified Chinese
51949EUC - Korean
51950EUC - Traditional Chinese
52936HZ-GB2312 Simplified Chinese
54936Windows XP: GB18030 Simplified Chinese (4 Byte)
57002ISCII Devanagari
57003ISCII Bengali
57004ISCII Tamil
57005ISCII Telugu
57006ISCII Assamese
57007ISCII Oriya
57008ISCII Kannada
57009ISCII Malayalam
57010ISCII Gujarati
57011ISCII Punjabi
65000Unicode UTF-7
65001Unicode UTF-8
The following is a list of valid code page identifiers for Mac OS only:
IdentifierName
1ASCII
2NEXTSTEP
3JapaneseEUC
4UTF8
5ISOLatin1
6Symbol
7NonLossyASCII
8ShiftJIS
9ISOLatin2
10Unicode
11WindowsCP1251
12WindowsCP1252
13WindowsCP1253
14WindowsCP1254
15WindowsCP1250
21ISO2022JP
30MacOSRoman
10UTF16String
0x90000100UTF16BigEndian
0x94000100UTF16LittleEndian
0x8c000100UTF32String
0x98000100UTF32BigEndian
0x9c000100UTF32LittleEndian
65536Proprietary

LicenseInfo:   Information about the current license.

When queried, this setting will return a string containing information about the license this instance of a class is using. It will return the following information:

  • Product: The product the license is for.
  • Product Key: The key the license was generated from.
  • License Source: Where the license was found (e.g., RuntimeLicense, License File).
  • License Type: The type of license installed (e.g., Royalty Free, Single Server).
  • Last Valid Build: The last valid build number for which the license will work.
MaskSensitiveData:   Whether sensitive data is masked in log messages.

In certain circumstances it may be beneficial to mask sensitive data, like passwords, in log messages. Set this to true to mask sensitive data. The default is true.

This setting only works on these classes: AS3Receiver, AS3Sender, Atom, Client(3DS), FTP, FTPServer, IMAP, OFTPClient, SSHClient, SCP, Server(3DS), Sexec, SFTP, SFTPServer, SSHServer, TCPClient, TCPServer.

ProcessIdleEvents:   Whether the class uses its internal event loop to process events when the main thread is idle.

If set to False, the class will not fire internal idle events. Set this to False to use the class in a background thread on Mac OS. By default, this setting is True.

SelectWaitMillis:   The length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.

If there are no events to process when DoEvents is called, the class will wait for the amount of time specified here before returning. The default value is 20.

UseInternalSecurityAPI:   Whether or not to use the system security libraries or an internal implementation.

When set to false, the class will use the system security libraries by default to perform cryptographic functions where applicable.

Setting this configuration setting to true tells the class to use the internal implementation instead of using the system security libraries.

On Windows, this setting is set to false by default. On Linux/macOS, this setting is set to true by default.

To use the system security libraries for Linux, OpenSSL support must be enabled. For more information on how to enable OpenSSL, please refer to the OpenSSL Notes section.

Trappable Errors (NFSClient Class)

NFSCLIENT Errors

500   Invalid state error. Please see the error description for further details.
550   An unsupported attribute was encountered.
551   An error was encountered changing the remote path.
553   The remote file could not be found before performing an upload or download operation.
554   The local file could not be found before performing an upload or download operation.
555   The current upload or download was manually aborted.
557   When manually uploading or downloading a specified range, the buffer specified was empty or null.
558   When manually uploading or downloading a specified range, the starting byte or count was negative.
559   When manually uploading or downloading a specified range, the count was greater than the size of the buffer.
560   When downloading, this indicates the local file exists and the Overwrite property is false.
561   An invalid link option was specified when creating a link. Only values of 0 (symbolic link) and 1 (hard link) are supported.
562   When uploading, this indicates the local file could not be found.
567   When uploading, this indicates an error occurred opening the local file.
568   When uploading, this indicates an error occurred while skipping the starting bytes of the local file.
569   An error was encountered while uploading a file. Please see the error description for more details.
570   An error was encountered while downloading a file. Please see the error description for more details.