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

  • SEARCH
  • Home
  • 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. I've read through some of the source code I've
I'm new to IOS development, and I'm just trying to get my head around
I am new in ios development.Now,i am developing an Ipad application using ios 4.2
I'm really new to iOS development and I'm trying to create a simple table
I'm new to ios development, and I'm using checkmark for cells in a UITableView
I am new to ios development. I want to create a local Sybase Ultralite
I am BRAND new to iOS development and am building my first app using
I'm new to iOS development - How do I create a Safari extension that
new to iOS development, i have managed to create a basic app that can
I am new iOS development but I know android at eclipse. For example I

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.