The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.
Hi,
I'm trying to get the file from remote TW server's SystemRepository to local file system, after calling all necessary C SDK v2.2.1 API functions:
twApi_Initialize(hostname, port, (char*)TW_URI, myPasswordCallback, NULL, MESSAGE_CHUNK_SIZE, MESSAGE_CHUNK_SIZE, (char)TRUE);
twApi_SetSelfSignedOk();
twApi_DisableCertValidation();
twApi_BindThing(thingName);
twcfg.file_xfer_staging_dir= (char*) "/home/davmel/stagingdir";
twFileManager_Create();
twFileManager_AddVirtualDir(thingName, (char*) "incoming", (char*) "/home/davmel/stagingdir/transfer/incoming");
twApi_Connect(CONNECT_TIMEOUT, twcfg.connect_retries);
Here all above calls return 0 error code.
But when I try here to get the remote file, I'm getting 1114 TW_GATEWAY_TIMEOUT error code.
err = twFileManager_GetFile(systemRepo, "outgoing", sourceFile, thingName, "/incoming", targetFile, 40000, FALSE, &tid1);
The remote thing thingName is created as thing based on RemoteThingWithFileTransfer template. When I run my program I can see that this thing is connected. I have #define ENABLE_FILE_XFER 1 in my header file.
Please suggest what can be done to overcome this issue.
Just wondering how big is the file you are trying to transfer?
Also does the agent have all the proper permissions, I remember it sometimes needing to create a temporary staging folder when doing the transfer.
The file is just 10 bytes. Not sure what kind of permissions do you mean, but for staging directory I have this:
twcfg.file_xfer_staging_dir= (char*) "/home/davmel/stagingdir";
Is there any other settings missed?
basic CRUD for the Agent to be able to read/write/create/delete files in the staging folder (or even create subfolders)
The link that you provided brings me to my original post, please update it. Thanks.
I think that CRUD should be created by calling:
twFileManager_AddVirtualDir(thingName, (char*) "incoming", (char*) "/home/davmel/stagingdir/transfer/incoming");
Which already is done, but doesn't help to transfer the file.