LastDisconnectReasonCode Property (IPICollective interface)



A read-only property that, like the LastDisconnectMessage, is set when a session to a server is closed or lost. The property returns a value from the pisdkSrvDisconnectReasonCode enumeration.  This property is supported against non-collective servers as well.



The object placeholder is an object expression that evaluates to a IPICollective interface, obtained from a Server object.


Disconnections can occur from the server being shutdown, the server crashing due to hardware or software problems, network disruptions, or the application closing the server. 

Use of an enum allows programs to take appropriate action without parsing a string which may change.


The return value from the pisdkSrvDisconnectReasonCode  enumeration can have one of the following values:

Setting Description
sdcUnplanned The connection to the server has been lost without warning.
sdcPlannedShutdown The connection was closed by the PI-SDK because the connected server has started a shutdown.  This will only occur on PI server versions 3.4.375 and later.
sdcAutoSwitchMember The connection was closed by the PI-SDK because a call was made which requires features not supported on this member of the collective but is supported on another member.  The connection should have been restored to another member of the collective that can satisfy those requirements.  This will only occur on collectives.
sdcManualSwitchMember The application has initiated a connection to another member of the collective and closed this one through a call to SwitchMember.  This will only occur on collectives.
sdcUserClose The application has explicitly closed the connection using Server.Close.

Trappable Errors

In addition to generic errors (such as Out of Memory), the following errors may occur:



E_INVALIDARG, E_POINTER Some of the function argument are not valid.
Enabling Operational Intelligence