Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bind, udp and broadcast



I'm moving some code to MacOSX/Darwin written for Linux and Windows which use some non-portable techniques. What I need to do is receive ipv4 udp packets sent to the interface address, the interface's broadcast address, and the all-1's broadcast (INADDR_BROADCAST), and know which interface the packet was received on and what the destination ip address of the packet is. Linux and newer versions of Windows can do this with IP_PKTINFO, and I was hoping IP_RECVDSTADDR could help me here.

Unfortunately, it seems broadcast packets are only received on sockets either bound to INADDR_ANY or to the specific broadcast address. IP_RECVDSTADDR could help me determine which interface the first two cases came in on, but not the INADDR_ANY situation.

I don't want to resort to bpf to do this. Is there another option? And why don't broadcast packets show up on sockets bound to the interface address?
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.