controller callback text_file_put unexpected truncation - is there a size limit?
search cancel

controller callback text_file_put unexpected truncation - is there a size limit?

book

Article ID: 279929

calendar_today

Updated On: 02-28-2024

Products

DX Unified Infrastructure Management (Nimsoft / UIM)

Issue/Introduction

I am attempting to use the controller callback text_file_put in a Lua script to transfer a file from one robot to another, as follows:

  mypds = pds.create()
  pds.putString ( mypds, "directory", "/path/to/destination")
  pds.putString ( mypds, "file", "MyFileName" )
  pds.putString ( mypds, "mode", "string" )
  pds.putString ( mypds, "file_contents", MyData)
      
 nimbus.request(/path/to/controller/, "text_file_put", mypds, 5, 1, 1000 )

 

However, the file on the receiving end is truncated unexpectedly - is there a size limit for the amount of data that can be sent with this method?

Resolution

There is no specific size limit other than the amount of data which each system can hold in memory - however, we have observed that if a NULL termination character:    \0    is present in the data, the transmission will be truncated.

To sanitize text-based data and remove NULLs you can use the following Lua, where "MyData" is a string holding the data you are transmitting.

MyData = MyData:gsub("\0" , "")

 

This will remove the NULL termination characters from the data.