S
Shoveler
I'm trying to send an ARP to determine different devices on the
network. I need to see the MAC address of my devices on my LAN. With
the MAC I can determine if I need to talk to that devices. I figured
the ARP is the best we to find who is out there. I'm using C# and the
Raw SocketType. I run into the WSACancelBlockingCall problem. Here's
my code:
Socket MyPing = new Socket(AddressFamily.InterNetwork,
SocketType.Raw , ProtocolType.IP );
MyPing.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.HeaderIncluded, true);
byte[] DataARP = new byte[] { 00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00,
0x01, 0x00, 0x13, 0x8f, 0x88, 0xe1, 0x51, 0xc0, 0xa8, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xa8, 0x00, 0x0a };
//Fake an IP Address so I can send with SendTo
IPAddress IP = new IPAddress(new byte[] { 192, 168, 1, 1
});
IPEndPoint IPEP = new IPEndPoint(IP, 5931);
//Local IP for Receiving
IPEndPoint Local = new IPEndPoint(IPAddress.Any, 0);
EndPoint EP = (EndPoint)Local;
MyPing.SendTo(DataARP, IPEP);
It's a very simple app. All I want to do is send data only with the
Eithernet II Header. I figured I need a Raw socket, but it's canceling
my sending. I'm debuging with Ethereal.
network. I need to see the MAC address of my devices on my LAN. With
the MAC I can determine if I need to talk to that devices. I figured
the ARP is the best we to find who is out there. I'm using C# and the
Raw SocketType. I run into the WSACancelBlockingCall problem. Here's
my code:
Socket MyPing = new Socket(AddressFamily.InterNetwork,
SocketType.Raw , ProtocolType.IP );
MyPing.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.HeaderIncluded, true);
byte[] DataARP = new byte[] { 00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00,
0x01, 0x00, 0x13, 0x8f, 0x88, 0xe1, 0x51, 0xc0, 0xa8, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xa8, 0x00, 0x0a };
//Fake an IP Address so I can send with SendTo
IPAddress IP = new IPAddress(new byte[] { 192, 168, 1, 1
});
IPEndPoint IPEP = new IPEndPoint(IP, 5931);
//Local IP for Receiving
IPEndPoint Local = new IPEndPoint(IPAddress.Any, 0);
EndPoint EP = (EndPoint)Local;
MyPing.SendTo(DataARP, IPEP);
It's a very simple app. All I want to do is send data only with the
Eithernet II Header. I figured I need a Raw socket, but it's canceling
my sending. I'm debuging with Ethereal.