>> Hi everyone,
>I would say "You can't" (Barry, correct me if i'm wrong:-)
>If you are interested in which of your local addresses
>a datagram is addressed to, open one socket on each
>(and possibly select() on each filediscriptor).
>Why do you care ? You should be able to return it
>using the "from-address" anyway ?
RFC 1122 says that UDP-based applications SHOULD set the source address of
replies to the destination address of the query. Modern DNS resolver and
recursive server implementations, for instance, will ignore responses that
come from a different address than the query was sent to, to catch some
attempts at spoofing responses.
Quote:>> I'm encoutering the following problem running a socket UDP
>> server under Solaris2. The server listens for incoming
>> packets on a socket that was bound (ie <bind>ed) using
>> INADDR_ANY as the value of the sin_addr.s_addr field. The
>> server runs on a mutliple-address machine, and this option
>> enables you to leave unspecified the adress to which you
>> want to bind the socket, and say that any of the machine's
>> addresses will do (well, i suspect those who'll be able to
>> answer know that already, but anyway).
>> So, my question is, once i've received a packet on that
>> socket (via recvfrom()), how do i determine the IP address
>> it was sent to ? That is to say, how can i tell which of the
>> several valid IP addresses for my machine the sender used ?
>> Thanks,
>> GM -
>--
>--
>Peter H?kanson Phone +46 0708 39 23 04
>Network Management AB Fax +46 031 779 7844
--
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Don't bother cc'ing followups to me.