Hello.
I use for exchange wxDatagramSocket.
wxIPV4address BroadCastAddress;
BroadCastAddress.Hostname(_("XXXXXXXXXXX"));
BroadCastAddress.AnyAddress();
BroadCastAddress.Service(48660);
// Create the socket
M_UDP_socket = new wxDatagramSocket(BroadCastAddress, wxSOCKET_WAITALL_WRITE);
wxIPV4address raddr;
raddr.Hostname("192.168.1.5");
raddr.Service(5001);
....
.....
.....
my_size = M_UDP_socket->SendTo(raddr, &My_data_buf, sizeof(My_data_buf)).LastCount();
Send data is successful and receiver is successful is recive data. The is no problem.
The question is, when I receive data back from the sender, how can I see the MAC address of the device that answered me?
Regards, Dmitry.
How to get device maC address?
Re: How to get device maC address?
Hi,
Which protocol you are using - TCP or UDP?
You will need to parse the packet header and see the information you need. Unless you have control over the sender...
Thank you.
Which protocol you are using - TCP or UDP?
You will need to parse the packet header and see the information you need. Unless you have control over the sender...
Thank you.
- T-Rex
- Moderator
- Posts: 1249
- Joined: Sat Oct 23, 2004 9:58 am
- Location: Zaporizhzhya, Ukraine
- Contact:
Re: How to get device maC address?
wxDatagramSocket is a derived class from wxSocketBase.
wxSocketBase has a SetNotify() method that enables the subscription for the relevant events
When you get the incoming data, your event handler should be triggered.
In the event handler you will get the wxSocketEvent.
The wxSocketEvent object has a GetSocket() method that returns the relevant wxSocketBase pointer.
wxSocketBase has a GetLocal() and GetPeer() method. I assume that GetPeer() should return the address that has sent the message.
wxSocketBase has a SetNotify() method that enables the subscription for the relevant events
When you get the incoming data, your event handler should be triggered.
In the event handler you will get the wxSocketEvent.
The wxSocketEvent object has a GetSocket() method that returns the relevant wxSocketBase pointer.
wxSocketBase has a GetLocal() and GetPeer() method. I assume that GetPeer() should return the address that has sent the message.
Re: How to get device maC address?
OP is looking for the MAC address not IP.
Maybe try Wireshark and check if the information is available at all.
( I have no experience with Wireshark and can't help with its use)
Use the source, Luke!