You are on page 1of 10

Connect:DirectforWindows.

NetSDK
Overview
TheConnect:DirectforWindows.NetSDKallowssystemprogrammerstoextendthecapabilitiesofthe Connect:DirectforWindowsenvironment.ThisSDKsupportsanyversionofthe.Netframeworkfrom Microsoftusingany.Netsupportedprogramminglanguage(C#,VB.Net,J#,etc.).

ConnectionSettings
TheConnect:DirectforWindows.NetSDKcanutilizepreconfiguredconnectionsettings.For informationonthisfeatureseeEditingConnectionsSettingsintheConnect:DirectforWindowsSDK ProgrammingGuide.

SamplePrograms
Severalsamplesourcecodeprojectsareprovided.Thesearemeanttoshowbasicexamplesofhowto usethe.NetSDK.Torunthesamples,youwillneedCdCore.dllandConnectDirectSdk.dllinyour executablepath.Youcancopythesefilestothesamedirectoryasthesampleexecutables.

VB.Net
AVb.Netsampleprogram,VbDotNetSample1,hasbeenprovided.Thisisaconsoleprogramthat connectstoanode,submitsaprocessfromafile,anddisplaysthestatisticsfortheprocesssubmitted. Lookforthe$todotagsintheModule1.vbsourcefileandchangethevariablestobevalidforyour Connect:DirectforWindowsnode.

C#.Net
TwoC#sampleGUIprogramsareprovided.Lookforthe$todotagsintheSDKInterface.cssource filesforeachsampleandchangethevariablestobevalidforyourConnect:DirectforWindowsnode. DotNetSample1Thisprogramconnectstoanode,issuesaselectprocess,thendisplaystheprocess informationreturned. DotNetSample2Thisprogramconnectstoanode,submitsaprocessandthendisplaystheprocess informationandthestatisticsinformationfortheprocesssubmitted.

Usingthe.NetClassInterface
Files
ThefollowingfilesareprovidedwiththeConnect:DirectforWindows.NetSDK. 1) ConnectDirectSdk.dllThisModuleisamanageddllwhichinterfacesyour.Netmanaged programtotheunmanagedConnect:DirectforWindowsdll(CdCore.dll).Thisfilemustbe copiedtoafolderthatisinyourexecutablepath. 2) CdCore.dllThisModuleisanunmanageddllwhichinterfacestotheConnect:Directfor WindowsServer.Thisfilemustbecopiedtoafolderthatisinyourexecutablepath. 3) ConnectDirectSdk.xmlThismoduleistheIntellisensehelpfilewhichVisualStudiousesfor quickinformation,autocompletionandparameterhelp.

Addingtoyour.Netproject
ProjectProperties TousetheConnect:DirectforWindows.NetSDKinterfaceyoumustaddtheConnectDirectSdk.dllasa referenceinyourVisualStudioproject.Dothefollowingsteps: 1) SelectProjectfromthemenuthenselectAddReference 2) SelectBrowsetosearchfortheConnectDirectSdk.dll 3) BrowsetothelocationoftheConnect:DirectforWindows.NetSDKinstallation.Thedefault locationisC:\ProgramFiles\SterlingCommerce\ConnectDirect v4.5.00\SDK.Net\Sdk_Files\Release 4) Click(highlight)thefileConnectDirectSdk.dllthenclickOK SourceModules Also,withinyoursourcefile,youmustimporttheConnectDirectSdknamespace. InVb.Net,addthefollowingtoyoursourcemodules: Imports ConnectDirectSdk

InC#.Net,addthefollowingtoyoursourcemodules: Using ConnectDirectSdk;

Classes
Node TheNodeclassisthemaininterfacetotheConnect:DirectforWindowsServer.Itcontainsthehigh levelConnect:Directfunctionality.Itallowsyoutoconnect,submitprocesses,selectstatistics,etc. AlmostallaccesstotheConnect:DirectforWindowsServeristhroughtheNodeobject.TheNode objectcreatesandremovestheconnectiontotheConnect:DirectforWindowsServer.Connectionsare sharedandreusedasdifferentrequestsaremade.

Process TheProcessclassallowsyoutoretrieveinformationaboutprocessesthatyousubmitorthatareinthe TCQ.ItcontainsalloftheprocesscriteriareturnedfromaSubmitorSelectProcmethodcall. Statistic TheStatisticclassallowsyoutoretrievethestatisticrecordsfromtheTCQ.Itrepresentsagroupof recordsinthestatisticsdatabase.TheyarereturnedfromaSelectStatmethodcall.

NodeClass
ConnectingtotheConnect:DirectforWindowsNode
ThenameoftheConnect:Directnodeandtheconnectioninformationissetatobjectcreationtime usingtheNodeconstructor.Ifaparameterisnotsupplied(NULLpointer),thedefaultvalueforthat parameterisreadfromtheRegistry.Duringconstruction,theNodeobjectattemptstoconnecttothe physicalConnect:Directnode,usingtheprotocolinformationcontainedintheRegistry.Ifthe connectionfails,anexceptionisthrown. Inthefollowingconstructor,stNodeisrequired.stUserandstPassareoptional.stPassisignoredif stUserisnotprovided.
Node(String stNode, String stUser, String stPass)

Inthefollowingconstructor,stLcuFileisrequired.ThisisthefilespecforanLCUfilethatcontainsthe logininformation. Node(String stLcuFile)

DisconnectingNodes
UsetheDisconnectAllmethodtodisconnectfromallNodes.
bool DisconnectAll()

SubmittingProcesses
UsetheSubmitandSubmitFiletosubmitprocessesforexecutiononthenode.Thisautomatically createsaProcessobjectandassociatesitwiththenodefortheSubmit. ThisisthestandardSubmitFilemethod.stFileNameisrequiredandisthefilespecofthe Connect:Directprocesstosubmit.
void SubmitFile(String stFileName)

This SubmitFile method allows more control of the submitted process. stFileName is required and is the file spec of the Connect:Direct process to submit. holdOverride allows you to place this process in the Hold queue. startTime allows you to specify the time to run the process. symbolics are the substitution paramaters to apply to this process. void SubmitFile(String stFileName, Hold holdOverride, String startTime, Dictionary<String, String> symbolics)

The Submit method is very similar to the SubmitFile method above but instead of passing a file name of the process to submit, you pass stText which is the text itself of a Connect:Direct process to submit. void Submit(String stText, Hold holdOverride, String startTime, Dictionary<String, String> symbolics)

ManipulatingProcesses
TheNodeobjecthasseveralmethodsthatallowyoutomanageprocesses.Youcanview,changeand deleteprocesses.YoucanalsoplaceaprocessonHoldandreleaseitfromHold.Eachofthesemethods willreturnprocessinformationintheProcessListpropertyoftheNodeclassofeachprocessthatwas selectedorchanged. ThisSelectProcmethodallowsyoutoretrievealistofalloftheprocessesfromtheTCQ.
void SelectProc()

ThisSelectProcmethodallowsyoutoretrievealistofalloftheprocessesfromtheTCQwhose processnamematchesstName.
void SelectProc(String^ stName)

ThisSelectProcmethodallowsyoutoretrievealistofalloftheprocessesfromtheTCQwhose processnumbermatchesnNumber.
void SelectProc(int nNumber)

ThisSelectProcmethodallowsyoutoretrievealistofalloftheprocessesfromtheTCQwhose processnamematchesanynameinthearrayarrayNames.
void SelectProc(array<String^>^ arrayNames)

ThisSelectProcmethodallowsyoutoretrievealistofalloftheprocessesfromtheTCQwhose processnumbermatchesanynumberinthearrayarrayNumbers.
void SelectProc(array<int>^ arrayNumbers)

TheHoldProcmethodallowsyoutoplaceaprocessintheTCQonHOLD.pProcessisaprocess object.
void HoldProc(Process^ pProcess)

ThisReleaseProcmethodallowsyoutoreleaseaprocessintheTCQtorunthatwasonHOLD. pProcessisaprocessobject.
void ReleaseProc(Process^ pProcess)

ThisReleaseProcmethodallowsyoutoreleaseaprocessintheTCQtorunthatwasonHOLD. nNumberistheprocessnumberoftheprocesstorelease,stPNodeistheprimarynodeofthe processestorelease,andstUseridistheUseridoftheprocessestorelease.


void ReleaseProc(int nNumber, String^ stPNode, String^ stUserid)

ThisDeleteProcmethodallowsyoutodeleteaprocessfromtheTCQ.pProcessisaprocessobject.
void DeleteProc(Process^ pProcess)

ThisDeleteProcmethodallowsyoutodeletaaprocessfromtheTCQ.nNumberistheprocess numberoftheprocesstodelete,stPNodeistheprimarynodeoftheprocessestodelete,and stUseridistheUseridoftheprocessestodelete.


void DeleteProc(int nNumber, String^ stPNode, String^ stUserid)

RetrievingStatistics
UsetheSelectStatmethodstoretrievestatisticsfromthestatsdatabase.Statsarereturnedinthe StatsListpropertyoftheNodeclass.

ThisSelectStatmethodallowsyoutoretrievealistofallstatisticrecordsfromthestatsdatabase. Pleasenotethatthiscouldbeverylargedependingonhowmanydaysofstatsrecordsarekeptinthe database.


void SelectStat()

ThisSelectStatmethodallowsyoutoretrievealistofallstatisticrecordsfromthestatsdatabasefora specificprocess.pProcessistheprocessobjecttoretrievethestatsfor.
void SelectStat(Process^ pProcess)

ThisSelectStatmethodallowsyoutoretrievealistofallstatisticrecordsfromthestatsdatabase withinaspecifiedtimerange.dtBeginisthebeginningtimestampforthestatsanddtEndisthe endingtimestamp.ThetimestampsareintheformatofMM/DD/YYYYhh:mm:ssAM|PM.


void SelectStat(String^ dtBegin, String^ dtEnd)

NodeProperties
ApiVersion CDName Name OSSubType OSType ProcessEntry ProcessList Returns the CD API version of the node as a long. Returns the Connect:Direct node name sent to the client after successfully logging on to the node. Returns the alias node name passed in the constructor. Returns the Operating System sub-type (additional information) of the Node. Returns the Operating System type of the Node. Returns the process from a Submit call. Returns an array of processes.

SecurePlusSupported Indicates whether the node supports Secure Plus. SecurePlusVersion Server StatsList Userid

Returns the Secure Plus version information as a long Returns the file server name the Connect:Direct node is running on. Returns an array of Stat messages from a SelectStat call. Returns the User ID used to log into the node.

Processclass
TheprocessclasscontainsalloftheprocesscriteriareturnedfromaSUBMITorSELECTPROCESS method.ProcessesaresubmittedusingtheNode.SubmitorNode.SubmitFilemethods.

Waitingforprocesscompletion
ThisWaitForCompletionmethodblocksthecurrentthreaduntiltheprocesshasexitedallqueueson theConnect:DirectServer,includingerrorqueues.Itwaitsindefinitely.
void WaitForCompletion()

ThisWaitForCompletionmethodblocksthecurrentthreaduntiltheprocesshasexitedallqueueson theConnect:Directserver,includingerrorqueues,oruntilthetimeoutperiodhasexpired.timeoutis inmilliseconds.


void WaitForCompletion(long timeout)

Processproperties
ByteCount Checkpoint Class ConditionCode DestDisp1 DestDisp2 DestDisp3 DestFile ExecPriority Returns the Bytes read/written from the file as a long. Returns the Checkpointing Enabled flag. Returns the session class property as a String. Returns the Return Code as an int. Returns the Destination Displacement 1 as a char. Returns the Destination Displacement 2 as a char. Returns the Destination Displacement 3 as a char. Returns the Destination File Name as a String. Returns the Current Execution Priority as a String.

ExtendedCompression Returns the Extended Compression flag. Feedback Returns the Additional Return Code Information as an int.

FromNode Function Hold LocalNode LogDateTime MsgData MsgId MsgText Name Number PNode Priority Queue RecordCount Restart Retain SchedDateTime SecureEnabled SecureProtocol Signature SNode SourceDisp1 SourceDisp2 SourceDisp3

Returns the From Node flag. Returns the Current Function Executing as a String. Returns the Hold flag as a char. Returns the Local Node indicator flag. Returns the Logged Timestamp. Returns the Message Substitution Data as a String. Returns the Message Identifier field as a String. Returns the Message Text field as a String. Returns the Process Name as a String. Returns the Process Number as an int. Returns the Primary Node Name as a String. Returns the Current Priority as in int. Returns the Process Queue as a String. Returns the Records read/written as a long. Returns the Restart flag. Returns the Retain flag as a char. Returns the Scheduled Timestamp. Returns the Secure+ enabled flag. Returns the Secure+ Protocol as a String. Returns the Secure+ effective Signature setting. Returns the Secondary Node Name as a String. Returns the Source Displacement 1 as a char. Returns the Source Displacement 2 as a char. Returns the Source Displacement 3 as a char.

SourceFile SSLCipherSuite

Returns the Source File Name as a String. Returns the Secure+ SSL Cipher Suite as a String.

StandardCompression Returns the Standard Compression flag. Status StepName STSCtrlCipher STSDataCipher SubmitNode Submitter XmitBytes XmitRUs

Returns the Current Status as a String. Returns the Current Stepname as a String. Returns the Secure+ STS Control Cipher as a String. Returns the Secure+ STS Data Cipher as a String. Returns the Submitter's Node Name as a String. Returns the Submitter's User Id as a String. Returns the Bytes sent/received count as a long. Returns the RUs sent/received as a long.

StatisticClass
TheStatisticclassrepresentsagroupofrecordsinthestatisticsdatabase.Theyarereturnedbya SelectStatmethodcall.

AuditInformation
TheGetAuditFieldmethodreturnsthevalueofthefieldrequestedfromtheStatsAuditInformation. AuditdatainStatsrecordsisoptionalandStatrecordscanhavedifferentauditfieldavailable.stField isthenameoftheauditfieldyouarerequestinginformationfor;stValueisthevalueofthefield requested.ThismethodreturnsTRUEiftheauditfieldwasfoundandFALSEifnot.
BOOL GetAuditField(String^ stField, String^% stValue)

StatisticProperties
ConditionCode Returns the Return Code. Feedback Returns the Additional Return Code information.

LogDateTime Returns the Logged Timestamp. MsgData MsgId MsgText ProcessName Returns the Message Substitution Data as a String. Returns the Message Identifier field as a String. Returns the Message Text field as a String. Returns the Name of the process.

ProcessNumber Returns the Process number. RecCat RecId SNode Returns the Record Category. Returns the Record Identifier tag. Returns the Secondary Node Name.

StartDateTime Returns the Start Timestamp. StopDateTime Returns the Stop Timestamp. Submitter

Returns the User Id of the submitter.

You might also like