/// Last Modified: 10/17/10 /// <summary> /// Initializes the object with a port to host on, as well as the specific security model to use. /// </summary> /// ----------------------------------------------------- /// PRECONDITIONS: NA -- No preconditions exist. /// ----------------------------------------------------- /// Parameters: /// <param name="nHostPort"> /// The port the node will be hosted on. /// </param> /// <param name="nodeSecurityModel"> /// An object that manages the security model of the node. /// </param> /// ----------------------------------------------------- /// POSTCONDITIONS: NA -- No postconditions exist. /// ----------------------------------------------------- /// Return Value: public RootNode(int nHostPort, INodeSecurityModel nodeSecurityModel) { //Create the new node socket and host it at the supplied port. m_nodeSocket = new NodeSocket(nHostPort, nodeSecurityModel); m_nodeSocket.SetOnAsynchReceive = OnPacketReceive; m_nodeSocket.SetOnAsynchReceiveError = OnPacketReceiveError; HostPort = nHostPort; }
/// Last Modified: 9/13/10 /// <summary> /// Explicitly close the node and the socket. /// </summary> /// ----------------------------------------------------- /// PRECONDITIONS: The node's socket should be opened, but /// can be null as well. /// ----------------------------------------------------- /// Parameters: /// ----------------------------------------------------- /// POSTCONDITIONS: Close's the socket's node, where /// the socket has to be restarted. /// ----------------------------------------------------- /// Return Value: public virtual void Close() { if (m_nodeSocket != null) { m_nodeSocket.Close(); m_nodeSocket = null; } }