Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: (OT) Getting the source hardware address of received UDP packets?

by ikegami (Patriarch)
on Jun 01, 2006 at 07:59 UTC ( [id://552993]=note: print w/replies, xml ) Need Help??


in reply to (OT) Getting the source hardware address of received UDP packets?

recv "returns the address of the sender if SOCKET's protocol supports this" (which it does). I don't know if the destination address is available.

Update: Disregard the above. I misread your question. Time for bed.

The source address for UDP is an IP address. Ethernet packets can encapsulate IP packets, but they are completely unrelated. Neither the sender nor the receiver needs to use Ethernet to send or receive UDP packets. Asking for the Ethernet address for an IP address is akin to asking for the street address for an IP address. It may be possible, but it requires an external protocol (like ARP?).

If you do receive your IP packets from an Ethernet, the source address on the packet will be the one of your router and not the one of the computer sending the UDP packet (unless the sender is on your LAN).

By the way, I don't think getpeername works on UDP sockets, since there is no peer associated with a UDP socket. They are "unconnected". That's why the function that returns the sender's address (recv) is associated with a packet, not a socket.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://552993]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-03-29 05:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found