Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Nov 1997 16:50:55 -0700 (MST)
From:      Charles Mott <cmott@srv.net>
To:        Luigi Rizzo <luigi@labinfo.iet.unipi.it>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: a networking question...
Message-ID:  <Pine.BSF.3.96.971127164736.28870B-100000@darkstar.home>
In-Reply-To: <199711272216.XAA09193@labinfo.iet.unipi.it>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 27 Nov 1997, Luigi Rizzo wrote:
> I have the following problem with UDP:
> 
> if I receive a packet with recvmsg, the identity of the sender is
> returned in a sockaddr structure. However, I have no idea of the
> destination address this packet was sent to.
> 
> On a multihomed machine, this might be a problem even with unicast;
> on a single-homed machine, this is a problem with multicast.
> 
> Is there any way to be returned the destination address as well ?
> 
> 	Cheers
> 	Luigi

I had a similar question which was kindly answered by a person named Alex
(bag@sinbin.demos.su).  He suggested that I use the recvmsg() call, and
IP_RECVDSTADDR option enabled (man 4 ip). 

Another approach is to open a distinct socket for each address you are
listening on and then using select() and FD_ISSET to see which socket and
therefore which address the packet arrived at.

Charles Mott




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.971127164736.28870B-100000>