Re: Help creating CFSocket
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