Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4019834
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:09:13+00:00 2026-05-20T10:09:13+00:00

I am new to iOS development. I am attempting to create a read and

  • 0

I am new to iOS development. I am attempting to create a read and write stream. I am using the CFNetworking programming guide’s examples to try and get something working.

I am trying to schedule the read stream on the run loop to work around the issue of the streams blocking. Right away I have run into issues. How can I create a CFHost object using CFHhostCreateWithAddress? Here is what I have so far:

NSString *address = @"irc.ubuntu.net";
CFDataRef addressDataRef = (CFDataRef)[address dataUsingEncoding:NSASCIIStringEncoding];

CFHostRef host = CFHostCreateWithAddress(kCFAllocatorDefault, addressDataRef);

//Create Read and Write Stream
CFStreamCreatePairWithSocketToCFHost(kCFAllocatorDefault, host, 8008, &readStream, &writeStream);

The second line bombs. Can someone please tell me how to create a CFHostRef?

Thanks a lot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:09:13+00:00Added an answer on May 20, 2026 at 10:09 am

    The documentation states that the second argument to CFHostCreateWithAddress() must be “A CFDataRef object containing a sockaddr structure for the address of the host. This value must not be NULL.”

    You’re passing a CFDataRef representing “irc.ubuntu.net”, which is by no means a sockaddr struct.

    Use CFHostCreateWithName:

    CFHostRef CFHostCreateWithName (
       CFAllocatorRef allocator,
       CFStringRef hostname
    );
    

    As you probably know, you can cast an NSString * to CFStringRef, or create a constant CFStringRef with the macro CFSTR().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to iOS development and m curious to know how can i create
So i am new to iOS programming. I am using SDK 4.0 and you
I'm new to ios development and to stackoverflow. I did try searching both stackoverflow
I'm new to IOS development, and want to create something with tiles similar to
I'm new to iOS development and am running into an issue with my header
I am new to ios app development, Below is the code I used to
I'm new to iOS development. And i can't find an answer to a question
I'm new to iOS development and am working on this app that has a
I am new to ios development and I am trying to use some methods
I'm new to iOS development. I just installed Xcode 3.2.4 and the iOS 4.1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.