• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help creating CFSocket
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help creating CFSocket


  • Subject: Re: Help creating CFSocket
  • From: "Quinn \"The Eskimo!\"" <email@hidden>
  • Date: Tue, 26 Oct 2010 10:25:25 +0100

I can see a bunch of problems here, all centred around the following:

> NSData* addrData = [NSData dataWithBytes: addr4 length: addr4->sin_len];
> addr4->sin_port = 123;
> sig.address = (CFDataRef) addrData;

1. You should fill out all the fields of addr4, not just sin_addr and sin_port.  Specifically, you should fill out sin_family and sin_len.

2. sin_port should be in network byte order; you need a htons() here.

3. When you create addrData you take an immutable snapshot of addr4.  Changes to addr4 after that won't be effective.  You need to fully set up addr4 before creating addrData.

S+E
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Help creating CFSocket
      • From: Rick Mann <email@hidden>
References: 
 >Help creating CFSocket (From: Rick Mann <email@hidden>)

  • Prev by Date: Help creating CFSocket
  • Next by Date: Re: Help creating CFSocket
  • Previous by thread: Help creating CFSocket
  • Next by thread: Re: Help creating CFSocket
  • Index(es):
    • Date
    • Thread