void ProcessPolicyFile() { var s = new NetworkStream(skt); NWriter wtr = new NWriter(s); wtr.WriteNullTerminatedString(@"<cross-domain-policy> <allowed-access-from domain=""*"" to-ports=""*"" /> </cross-domain-policy>" ); wtr.Write((byte)'\r'); wtr.Write((byte)'\n'); parent.Disconnect(); }
static void ServePolicyFile(IAsyncResult ar) { TcpClient cli = (ar.AsyncState as TcpListener).EndAcceptTcpClient(ar); (ar.AsyncState as TcpListener).BeginAcceptTcpClient(ServePolicyFile, ar.AsyncState); try { var s = cli.GetStream(); NReader rdr = new NReader(s); NWriter wtr = new NWriter(s); if (rdr.ReadNullTerminatedString() == "<policy-file-request/>") { wtr.WriteNullTerminatedString(@"<cross-domain-policy> <allow-access-from domain=""*"" to-ports=""*"" /> </cross-domain-policy>"); wtr.Write((byte)'\r'); wtr.Write((byte)'\n'); } cli.Close(); } catch { } }
static void ServePolicyFile(IAsyncResult ar) { TcpClient cli = (ar.AsyncState as TcpListener).EndAcceptTcpClient(ar); (ar.AsyncState as TcpListener).BeginAcceptTcpClient(ServePolicyFile, ar.AsyncState); try { var s = cli.GetStream(); NReader rdr = new NReader(s); NWriter wtr = new NWriter(s); if (rdr.ReadNullTerminatedString() == "<policy-file-request/>") { wtr.WriteNullTerminatedString(@"<cross-domain-policy> <allow-access-from domain=""*"" to-ports=""*"" /> </cross-domain-policy>"); wtr.Write((byte)'\r'); wtr.Write((byte)'\n'); } cli.Close(); } catch { } }