/// <inheritdoc /> public override void WriteData(PresentationWriter writer) { writer.WriteUInt16(Priority); writer.WriteUInt16(Weight); writer.WriteUInt16(Port); writer.WriteDomainName(Target, appendSpace: false); }
private static void RunServer() { var service = "_appletv.local.appletv._local.appletv.local.appletv.local"; var mdns = new MulticastService(); mdns.QueryReceived += (s, e) => { var msg = e.Message; if (msg.Questions.Any(q => q.Name == service)) { var res = msg.CreateResponse(); var addresses = MulticastService.GetIPAddresses() .Where(ip => ip.AddressFamily == AddressFamily.InterNetwork); foreach (var address in addresses) { var ar = new ARecord { Name = service, Address = address }; var writer = new PresentationWriter(new StringWriter()); writer.WriteString("123qweq"); ar.WriteData(writer); ar.Name = "qweqeqweq"; res.Answers.Add(ar); } mdns.SendAnswer(res); } }; advertiseThread = new Thread(new ThreadStart(() => { sd = new ServiceDiscovery(mdns); var sp = new ServiceProfile("_itxpt_multicast._tcp.", "_itxpt._tcp", 5353, new List <IPAddress> { IPAddress.Parse("192.168.88.239") }); //sp.AddProperty("host", "192.168.88.239"); //sp.AddProperty("port", "14005"); sp.Resources.Add(new ARecord { Name = "_itxpt_multicast._tcp.", Address = IPAddress.Parse("192.168.88.239"), Class = DnsClass.ANY }); sp.Resources.Add(new SRVRecord { Name = "_itxpt_multicast._tcp.", Port = 5353, Priority = 0, Weight = 0, Class = DnsClass.ANY }); sp.Resources.Add(new PTRRecord { Name = "_itxpt_multicast._tcp.", DomainName = "192.168.88.239" }); sd.Advertise(sp); })); advertiseThread.Start(); mdns.Start(); }
public void Serialize() { var stream = new FileStream("settings.txt", FileMode.OpenOrCreate); var sw = new StreamWriter(stream); var writer = new PresentationWriter(sw); foreach (var info in DomainInformation.Values) { foreach (var rec in info.DomainRecords) { writer.WriteEndOfLine(); rec.Write(writer); } } stream.Position = 0; sw.Close(); }
/// <inheritdoc /> public override void WriteData(PresentationWriter writer) { writer.WriteDomainName(Mailbox); writer.WriteDomainName(TextName, appendSpace: false); }
/// <inheritdoc /> public override void WriteData(PresentationWriter writer) { writer.WriteString(Cpu); writer.WriteString(OS, appendSpace: false); }
/// <inheritdoc /> public override void WriteData(PresentationWriter writer) { writer.WriteDomainName(Authority, appendSpace: false); }
/// <inheritdoc /> public override void WriteData(PresentationWriter writer) { writer.WriteUInt16(Preference); writer.WriteDomainName(Exchange, appendSpace: false); }
/// <inheritdoc /> public override void WriteData(PresentationWriter writer) { writer.WriteUInt16(Subtype); writer.WriteDomainName(Target, appendSpace: false); }