How to send data to a physical address (SOCKET)

  • Thread starter Thread starter SWJust
  • Start date Start date
S

SWJust

Hi... is it possible to send data from a socket to at physical address (MAC)
on f.x another PC or Router ???
I have a IP header with information about another client, and this cannot be
altered, so I want to send the whole IP package to the server / router using
OSI layer 2 (datalink), but is it possible in C#, or do i have to write a
lowlevel driver.

Thanks
/Søren
 
Søren,

You might want to try and create a Socket with a SocketType of
SocketType.Raw. This will allow you to have access to the underlying
protocol, which will give you the responsibility of reading/writing the
headers, etc, etc.

Hope this helps.
 
Yes this was also my plan, but can I keep my existing IP header, and alter
the destination MAC address, and send it ? as I can understand Socket.Raw is
only at IP level, or am I wrong?




It has to work as a router, because it is going to interact with an Intel
router.




My idea was to create at Raw socket, read the header and determine on which
network interface card it has to be send out on, or which other router /
computer it should be send to, and the it is the next routers job to deliver
the package to the final destination.

I puzzled with the idea of using SendTo and specify an IPendPoint, but I
haven't tested it yet, but I think it could result in a failure, because of
my packaged header, and the new one sendTo tries to use. So my question was
is it possible to forward traffic to another Mac address.



/Søren




Nicholas Paldino said:
Søren,

You might want to try and create a Socket with a SocketType of
SocketType.Raw. This will allow you to have access to the underlying
protocol, which will give you the responsibility of reading/writing the
headers, etc, etc.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

SWJust said:
Hi... is it possible to send data from a socket to at physical address (MAC)
on f.x another PC or Router ???
I have a IP header with information about another client, and this
cannot
be
altered, so I want to send the whole IP package to the server / router using
OSI layer 2 (datalink), but is it possible in C#, or do i have to write a
lowlevel driver.

Thanks
/Søren
 
Back
Top