Click or drag to resize

LinkarClientSendXmlCommandAsync Method

Linkar Framework for .NET and Core


Allows a variety of asynchronous persistent operations using standard XML templates.

Namespace: Linkar.Commands.Persistent
Assembly: Linkar.Commands (in Linkar.Commands.dll) Version: 2.3.1
Syntax
public Task<string> SendXmlCommandAsync(
	string command,
	int receiveTimeout = 0
)

Parameters

command  String
Content of the operation you want to send.
receiveTimeout  Int32  (Optional)
Maximum time in seconds that the client will wait for a response from the server. Default = 0 to wait indefinitely.

Return Value

TaskString
The results of the operation.
Example
using Linkar;
using Linkar.Commands.Persistent;

class Test
    {
        public string MySendCommand()
        {
            string result = "";
            try
            {
                CredentialOptions credentials = new CredentialOptions("127.0.0.1", "EPNAME", 11300, "admin", "admin");
                LinkarClient client = new LinkarClient();
                client.Login(credentials);
                string command =
                    "<COMMAND NAME=\"READ\">" +
                    "   <CALCULATED>True</CALCULATED>" +
                    "   <OUTPUT_FORMAT>XML_DICT</OUTPUT_FORMAT>" +
                    "   <FILE_NAME>LK.CUSTOMERS</FILE_NAME>" +
                    "   <RECORDS>" +
                    "       <RECORD>" +
                    "           <LKITEMID>2</LKITEMID>" + 
                    "       </RECORD>" +
                    "   </RECORDS>" +
                    "</COMMAND>"
                result = client.SendXmlCommandAsync(command).Result;
                client.Logout();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                // Do something
            }
            return result;
        }
    }
See Also