/* private static void AutoBroadCastNews() * { * var news = File.ReadAllLines(@"news.txt"); * while (true) * { * foreach (var i in RealmManager.Clients.Values.ToArray()) * { * i.SendPacket(new TextPacket * { * Name = "@*NEWS*", * Stars = 0, * BubbleTime = 0, * Recipient = "", * Text = news[new Random().Next(news.Length)], * CleanText = news[new Random().Next(news.Length)] * }); * } * Thread.Sleep(3*(60*1000)); * } * } */ private static void ServePolicyFile(IAsyncResult ar) { // var cli = (ar.AsyncState as TcpListener).EndAcceptTcpClient(ar); TcpClient cli = (ar.AsyncState as TcpListener).EndAcceptTcpClient(ar); (ar.AsyncState as TcpListener).BeginAcceptTcpClient(ServePolicyFile, ar.AsyncState); try { var s = cli.GetStream(); // var rdr = new NReader(s); // var wtr = new NWriter(s); 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 { } }
private void ProcessPolicyFile() { var s = new NetworkStream(skt); var 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(); }
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) { var cli = (ar.AsyncState as TcpListener).EndAcceptTcpClient(ar); (ar.AsyncState as TcpListener).BeginAcceptTcpClient(ServePolicyFile, ar.AsyncState); try { var s = cli.GetStream(); var rdr = new NReader(s); var 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 { } }