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 7659221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:18:16+00:00 2026-05-31T13:18:16+00:00

I am working with a library called GCDAsyncUDPSocket and there is method that required

  • 0

I am working with a library called GCDAsyncUDPSocket and there is method that required me to pass the IP address and port as NSData.

Thanks for the help.

  • 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-31T13:18:17+00:00Added an answer on May 31, 2026 at 1:18 pm

    From the header file:

     * Binds the UDP socket to the given address, specified as a sockaddr structure wrapped in a NSData object.
     * 
     * If you have an existing struct sockaddr you can convert it to a NSData object like so:
     * struct sockaddr sa  -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len];
     * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len];
    

    So, you need a sockaddr:

    #include <netinet/in.h>
    #include <arpa/inet.h>
    
    struct sockaddr_in ip;
    ip.sin_family = AF_INET;
    ip.sin_port = htons(6003);
    inet_pton(AF_INET, "0.0.0.0", &ip.sin_addr);
    
    NSData * discoveryHost = [NSData dataWithBytes:&ip length:ip.sin_len];
    

    Here’s some documentation on sockaddr – http://www.beej.us/guide/bgnet/output/html/multipage/sockaddr_inman.html

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

Sidebar

Related Questions

I'm working on customizing a SharePoint document library called Quality Documents so that when
I am working with a shared library that is being called through the ctypes
I am working with a library that has a blocking call that never times
I am working on a library that allows its users (other libraries residing in
I am working with a SQL Library (Programming library, ANSI SQL Compliant, called ABS
I am working with the financial tooldbox that has a type called FINTS. If
Been working with the canvas element with a library called Raphael Current revision: http://jsfiddle.net/G5mTx/27/
I'm working on a general code library for ActionScript 3.0 called as3lib which includes
I'm working with a 3rd-party library that provides access to a database. In the
I 'm working on an html5 game which works on javascript library called propulsionjs.In

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.