Пример #1
0
		public Port( Server owner, XmlNode port_node )
		{
			Owner = owner;

			// --

			XmlAttribute a = port_node.Attributes["number"];
			if ( a!=null )
				Number = Convert.ToInt32(a.Value);
			else
				Number = (-1);

			a = port_node.Attributes["numberRangeBegin"];
			if ( a!=null )
				NumberRangeBegin = Convert.ToInt32(a.Value);
			else
				NumberRangeBegin = (-1);

			a = port_node.Attributes["numberRangeEnd"];
			if ( a!=null )
				NumberRangeEnd = Convert.ToInt32(a.Value);
			else
				NumberRangeEnd = (-1);

			// --

			a = port_node.Attributes["addressFamily"];
			if ( a!=null )
				AddressFamily = (AddressFamily)AddressFamily.Parse(typeof(AddressFamily),Convert.ToString(a.Value),true);
			else
				AddressFamily = AddressFamily.InterNetwork;

			a = port_node.Attributes["socketType"];
			if ( a!=null )
				SocketType = (SocketType)SocketType.Parse(typeof(SocketType),Convert.ToString(a.Value),true);
			else
				SocketType = SocketType.Stream;

			a = port_node.Attributes["protocolType"];
			if ( a!=null )
				ProtocolType = (ProtocolType)ProtocolType.Parse(typeof(ProtocolType),Convert.ToString(a.Value),true);
			else
				ProtocolType = ProtocolType.Tcp;
		}