Ejemplo n.º 1
0
 /// Last Modified: 10/17/10
 /// <summary>
 /// Initialize a node socket as a server that can receive
 ///  information locally on the host port supplied, depending on the security model.
 /// </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 NodeSocket(int nHostPort, INodeSecurityModel nodeSecurityModel)
 {
     //Create the local EndPoint and bind it to the socket.
     m_iepLocal = new IPEndPoint(IPAddress.Any, nHostPort);
     m_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
     m_Socket.Bind(m_iepLocal);
     m_nodeSecurityModel = nodeSecurityModel;
 }
Ejemplo n.º 2
0
        /// 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;
        }
Ejemplo n.º 3
0
 /// Last Modified: 10/17/10
 /// <summary>
 /// Initializes the child node to run on a specific port.
 /// </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 ParentNode(int nHostPort, INodeSecurityModel nodeSecurityModel)
     : base(nHostPort, nodeSecurityModel)
 {
     m_iepRoutingTable = new Dictionary<string, IPEndPoint>();
 }
Ejemplo n.º 4
0
 /// Last Modified: 10/17/10
 /// <summary>
 /// Initializes the child node to run on a specific port.
 /// </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 ChildNode(int nHostPort, INodeSecurityModel nodeSecurityModel)
     : base(nHostPort, nodeSecurityModel)
 {
 }