SocketServerManager\UnRegister

Description: Unregister a station from a group. The station must be unregistered whenever GroupName, or StationKey changes.
Returns: Invalid when complete
Usage: Script
Function Groups: Stream and Socket
Format: \SocketServerManager\UnRegister(Context, StationKey, GroupName)
Parameters:  
Context
Required. The context should be the root tag. This must have Discriminator() and Context() subroutines.
StationKey
Returned by Discriminator() in the root tag. An opaque string used to identify a particular station.
GroupName
The name of an IPListener tag (or group). This will be the source of the new data streams.
Comments: Users should wait until \SocketServerManager\Started is true before attempting to use the Register or Unregister functions.

Example:

ActiveDevAddr{PLC address to use in reads & writes                    };
ListenerGroup{SocketServerManager group to join                       };
IPAddressAllow{ Semicolon delimited string of IP addresses (or ranges
                        which can connect to this station};
  If Valid(Name) && \SocketServerManager\Started && Watch(1, ActiveDevAddr, ListenerGroup, IPAddressAllow);
  [
    CriticalSection(
      IfThen(Valid(ActiveDevAddr) != Valid(RegDevAddr) || ActiveDevAddr != RegDevAddr ||
             Valid(ListenerGroup) != Valid(RegGroup)   || ListenerGroup != RegGroup,
        \SocketServerManager\Unregister(Root, RegDevAddr, RegGroup);
      );
      RegDevAddr = ActiveDevAddr;
      RegGroup   = ListenerGroup;

       { Register with SocketServerManager }
      \SocketServerManager\Register(Root, RegDevAddr, RegGroup, IPAddressAllow);
    );
  ]