internal void ProcessRegister()
{
ushort txt_rec_length = 0;
byte [] txt_rec = null;
if (TxtRecord != null)
{
txt_rec_length = ((TxtRecord)TxtRecord.BaseRecord).RawLength;
txt_rec = new byte[txt_rec_length];
Marshal.Copy(((TxtRecord)TxtRecord.BaseRecord).RawBytes, txt_rec, 0, txt_rec_length);
}
_self = GCHandle.Alloc(this);
Log.To.Discovery.V(Tag, "{0} preparing to enter DNSServiceRegister");
ServiceError error = Native.DNSServiceRegister(out sd_ref,
auto_rename ? ServiceFlags.None : ServiceFlags.NoAutoRename, InterfaceIndex,
Name, RegType, ReplyDomain, HostTarget, (ushort)IPAddress.HostToNetworkOrder((short)Port), txt_rec_length, txt_rec,
register_reply_handler, GCHandle.ToIntPtr(_self));
if (error != ServiceError.NoError)
{
Log.To.Discovery.W(Tag, "Got error in DNSServiceRegister {0}", error);
Error(this, new ServiceErrorEventArgs("ProcessRegister", error));
sd_ref.Deallocate();
return;
}
sd_ref.Process();
}