Subject: Re: getting UDP destination port/addresses
To: Michael Richardson <email@example.com>
From: Andrew Brown <firstname.lastname@example.org>
Date: 01/07/2001 02:10:40
> My recollection was that there was some way to get the destination
>address/port to which an UDP packet was sent by toggle either options to
>recvmsg(), or via setsockopt(). The option was in 4.3, I'm sure... But I
>haven't used it since.
> Has it disappeared?
> I hate having to open a socket for each address that exists (a la BIND,
>etc...) , and this is NetBSD specific.
using IP_RECVDSTADDR and recvmsg(2) (instead of read(2), recv(2), or
recvfrom(2)) works just fine for me.
i usually drop my own (admittedly non-thread safe) implementation of
recvfrom(2) into program that i write that use udp that stuffs the
receiving ip address into a global for me to look at.
|-----< "CODE WARRIOR" >-----|
email@example.com * "ah! i see you have the internet
firstname.lastname@example.org (Andrew Brown) that goes *ping*!"
email@example.com * "information is power -- share the wealth."