title: Swift 3 - Convert c structure sockaddr_in to CFData
body: <p>I need your help, this code does not compile anymore in Swift 3</p>
  
  <pre><code>//: Let's set up the `sockaddr_in` C structure using the initializer.
  var sin = sockaddr_in(
      sin_len: UInt8(sizeof(sockaddr_in)),
      sin_family: sa_family_t(AF_INET),
      sin_port: in_port_t(0),
      sin_addr: in_addr(s_addr: inet_addr(routerIP)),
      sin_zero: (0,0,0,0,0,0,0,0)
  )
  
  //: Now convert the structure into a `CFData` object.
  let data = withUnsafePointer(&amp;sin) { ptr in
      CFDataCreate(kCFAllocatorDefault, UnsafePointer(ptr), sizeof(sockaddr_in))
  }
  
  //: Create the `CFHostRef` with the `CFData` object and store the retained value for later use.
  host = CFHostCreateWithAddress(kCFAllocatorDefault, data).takeRetainedValue()
  </code></pre>
  
  <p>I have to fix the line "withUnsafePointer" but I don't know how?</p>
  
  <p>I tried something like this</p>
  
  <pre><code>    let data = withUnsafePointer(to: &amp;sin) { ptr in
          CFDataCreate(kCFAllocatorDefault, UnsafePointer(ptr), MemoryLayout&lt;sockaddr_in&gt;.size)
      }
  </code></pre>
  
  <p>the compiler say I have to use withMemoryRebound but how ?
  thanks</p>