Dan McDonald writes:
> If I have UDP socket 's' bound to INADDR_ANY/500, can I do something like
> (pardon my abstraction):
>
> init_cmsg(&msg);
> add_data(&msg, data, len);
> add_name(&msg, peers_sockaddr_ptr); /* Assume len from sa_family */
> add_ancillary(&msg, IP{,V6}_PKTINFO, my_specific_local_addr)
>
> rc = sendmsg(s, &msg, 0);
>
> and it'll send a UDP datagram that looks like:
>
> IP (my_specific_local_addr -> peer_addr) + UDP (500, peer_port) + data
>
> correct?
Yep.
> If so, I'm golden. :)
I think so. Besides, I still can't quite figure out how setting
source port on a per-packet basis would work or why you'd ever want to
have it. I *think* it'd be similar to binding that port, but that
means a scan through all the conn_ts on every packet, and when you're
done, all you'd have is garbage -- you'd be using a port that's not
actually bound, *or* you'd be absconding with someone else's port.
If we had BSD's notion of relaxing some binding conflicts on a
per-user basis, this might be more interesting ...
--
James Carlson, Solaris Networking <[email protected]>
Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
_______________________________________________
networking-discuss mailing list
[email protected]