CFDataRef socketData = CFWriteStreamCopyProperty(writeStream, kCFStreamPropertySocketNativeHandle);
CFSocketNativeHandle handle;
CFDataGetBytes(socketData, CFRangeMake(0, sizeof(CFSocketNativeHandle)), &handle);
// handle now contains the same thing as CFSocketGetNative(aSocket)