AdsPortCloseEx
The connection (communication port) to the TwinCAT message router is closed. The port to be closed must previously have been opened via an AdsPortOpenEx call.
LONG AdsPortCloseEx(
long nPort
);
Return value
Returns the function's error state.