Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

DNSServiceRegister port argument is supposed to be in network byte order. #2

Closed
wants to merge 1 commit into from

2 participants

Jay R. Wren Aaron Bockover
Jay R. Wren

DNSServiceRegister port argument is supposed to be in network byte order. It was being sent in host byte order. I confirmed using avahi-browse -avtlr on a different network node.

Jay R. Wren jrwren Fix a network to host byte order bug (the same bug probably still exi…
…sts when reading a port for registered servies over the network)
e1a90a1
Aaron Bockover
Owner

Committed this as f71474d with fixed commit message and whitespace in the code (tabs->spaces). Thanks!

Aaron Bockover abock closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 24, 2011
Jay R. Wren jrwren Fix a network to host byte order bug (the same bug probably still exi…
…sts when reading a port for registered servies over the network)
e1a90a1
This page is out of date. Refresh to see the latest.
2  src/Mono.Zeroconf.Providers.Bonjour/Mono.Zeroconf.Providers.Bonjour/RegisterService.cs
@@ -106,7 +106,7 @@ public void ProcessRegister()
106 106
107 107 ServiceError error = Native.DNSServiceRegister(out sd_ref,
108 108 auto_rename ? ServiceFlags.None : ServiceFlags.NoAutoRename, InterfaceIndex,
109   - Name, RegType, ReplyDomain, HostTarget, port, txt_rec_length, txt_rec,
  109 + Name, RegType, ReplyDomain, HostTarget, (ushort)System.Net.IPAddress.HostToNetworkOrder((short)port), txt_rec_length, txt_rec,
110 110 register_reply_handler, IntPtr.Zero);
111 111
112 112 if(error != ServiceError.NoError) {
8 src/Mono.Zeroconf.Providers.Bonjour/Mono.Zeroconf.Providers.Bonjour/Service.cs
@@ -132,9 +132,9 @@ public override int GetHashCode()
132 132 set { UPort = (ushort)value; }
133 133 }
134 134
135   - public ushort UPort {
136   - get { return (ushort)IPAddress.NetworkToHostOrder((int)port); }
137   - set { port = (ushort)IPAddress.HostToNetworkOrder((int)value); }
138   - }
  135 + public ushort UPort {
  136 + get { return port; }
  137 + set { port = value; }
  138 + }
139 139 }
140 140 }

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.