# Ungueltiger Kontext Error message While file transfer



## herleraja (12 März 2018)

Hi,


I was trying to upload(and download) a file from my computer to Simantic S7 300 PLC. (I'm using AGLINK API to do so)


I tired with many options but i'm not able to do a file transfer. I'm pretty much new to SPS programming, so i'm not able to understand why i'm always getting "Ungueltiger Kontext Error message" or "Invalid context".


I have tried following code snippet, which also shows the same error.


public Int32 doNCK_CopyFromNC(Int32 connnr, Int32 timeout)
{
    Int32 result = 0;
    String filename = "";
    Int32 neededlen = 1000;
    Byte[] buff = new Byte[neededlen];

    result = AGL4.NCK_CopyFromNC(connnr, filename, buff, out neededlen, timeout);
    if(result != AGL4.AGL40_SUCCESS)
    {
        // Error happened
        String errormsg = "";
        AGL4.GetErrorMsg(result, out errormsg);
    }
    return result;
}


I have used a sample application that provided by DeltaLogic Company, but which giving similar issue.
https://drive.google.com/file/d/17C-TotWmFGKSEbCAxQPkOOYktBB9cPRG/view?usp=sharing







Since majority of the software forum and tools are in German i'm getting difficult to search this error in internet. Can anyone here please help me on resolving this issue ?




Regards
HERLE


----------



## Rainer Hönle (12 März 2018)

This is an API for Sinumerik NCK and not for a SIMATIC PLC. What do you want to upload to your PLC?


----------



## herleraja (12 März 2018)

Thanks for super quick reply. 

I wanted to upload a G code file(for some CNC machine). Or some program that i wanted to execute after uploading into the PLC.

Regards
HERLE


----------



## Rainer Hönle (12 März 2018)

You can't load a CNC programm to the PLC, you must load it in the NCK. Please tell me the MLFBNr of your "PLC" after connection.


----------



## herleraja (12 März 2018)

Ok. I heard [FONT=&quot]Sinumerik 840D [/FONT]has internally a PLC inside it, so i was trying to load file to PLC. But looks like i entered through wrong way.

MLFBNr : 6ES7 314-6EH04-0AB0


----------



## Rainer Hönle (12 März 2018)

This IS a PLC. You must connect to the NCK. Read the special Sinumerik manual of ACCON-AGLink for correct addressing mode. This depends on your selected interface.


----------



## Rainer Hönle (14 März 2018)

Do you have a now connection to the NCK? Can you download your program?


----------

