예제 #1
0
        public void Accept(XmlSocket Socket, System.Xml.XmlDocument FirstMessage)
        {
            Socket.WriterSettings.OmitXmlDeclaration = false;

            Socket.WriteStartDocument();
            Socket.WriteDocType("cross-domain-policy", null, "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd", null);
            Socket.WriteStartElement("cross-domain-policy");

            foreach (string Host in pHosts)
            {
                Socket.WriteStartElement("allow-access-from");
                Socket.WriteAttributeString("domain", Host);
                if (pPorts != null)
                {
                    Socket.WriteAttributeString("to-ports", pPorts);
                }
                Socket.WriteEndElement();
            }

            Socket.WriteEndElement();
            Socket.WriteEndDocument();
        }
예제 #2
0
파일: Server.cs 프로젝트: UCIS/UCIS.Core
        public bool Accept(TCPStream Stream)
        {
            XmlSocket XSocket = new XmlSocket(Stream);

            Stream.ReadTimeout = 5000;
            XmlDocument FirstMessage = XSocket.ReadDocument();

            if (FirstMessage == null)
            {
                return(true);
            }
            IModule module;

            if (Modules.TryGetValue(FirstMessage.FirstChild.Name, out module))
            {
                module.Accept(XSocket, FirstMessage);
            }
            else
            {
                Console.WriteLine("XMLServer.Accept: Module not found: " + FirstMessage.FirstChild.Name);
            }
            return(true);
        }