From: Hector Santos on
Stephen Myers > wrote:

>> So I am wondering if you would think or agree with me the SOCKET stack
>> *should* at least return the proper sockaddr for the ReceiveFrom() for
>> the particular UDP binded receive socket response?
>>
>> Comment?
>
> I'd be interested in seeing what something like WireShark records for
> this. It's quite possible that the three responses came from the same
> NIC and IP.
>
> Consider that HDEV1 receives a ping from each interface. It then
> responds with a UDP packet and a target IP. The SendTo() does not
> specify an interface, so HDEV1 is free to chose one arbitrarily.
>
> It is likely that all three responses came from the same interface.



It appears a solution is available for Windows 7 only socket option:

IP_ORIGINAL_ARRIVAL_IF [1]

Indicates if the WSARecvMsg function should return
optional control data containing the arrival interface
where the packet was received for datagram sockets.

This option allows the IPv4 interface where the packet
was received to be returned in the WSAMSG structure.

http://msdn.microsoft.com/en-us/library/ms738586(v=VS.85).aspx

But I don't have Windows 7 available to determine this.

Using IP_PKTINFO returns 255.255.255.255 for each interface. I
stopped their for now. :)


--
HLS
From: Joseph M. Newcomer on
It is a common mistake to think this information is even vaguely useful.

For example, my current machine has an IP address of 192.168.168.7. But when it goes
through my firewall, it gets translated. My firewall connects to my ISP and has an IP
address assigned by my ISP and which changes once a day, so the IP address I send from
today is not the IP address I send from tomorrow. And if, for some reason, the
192.168.168.7 were actually passed through, nearly every site in the world that uses local
IP address will probably have a 192.168.168.7 address assigned by its DHCP server, so that
proves nothing.

And there IS no "Mac address" of the sender, because my firewall does not disclose any
information to my ISP, and therefore it cannot be deduced from any information at the
receiver.

There is essentially nothing useful that can be deduced by knowing the sender's IP
address. In the real world, the number of firewalls and routers applying NAT (Network
Adress Translation) between my machine and recipient is almost always a number greater
than 1 (in my case, I know it is a MINIMUM of two).
joe

On Tue, 25 May 2010 06:02:40 -0700 (PDT), bernd <bernd.schuster12(a)googlemail.com> wrote:

>Hi,
>
>is it possible to get some more information (in the OnReceive-method)
>about a received ethernet packet (for example; the ip-addr and / or
>mac addr from the sender)?
>
>I`m using casyncsocket; a udp-listener (at a specific port)
>
>
>best regards
>Bernd
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
First  |  Prev  | 
Pages: 1 2 3
Prev: Bitmap dialogs
Next: CComQIPtr and XML question