Communicate between two systems using only MAC address

安稳与你 提交于 2019-12-08 03:43:30

问题


I want to know how to communicate between two systems using only MAC address using C program (without using IP address). I think this is raw ethernet communication. My requirement is to send data from client to server only by using the MAC address. May be this can be done by creating our own raw ethernet frame.

Please help me regarding this. If anybody has written code in C, please share.

This link may help you, http://aschauf.landshut.org/fh/linux/udp_vs_raw/ch01s03.html


回答1:


The libpcap library allows you to assemble raw Ethernet packets and send them directly to an adapter: the hardest part being the discovery of the correct adapter. This is designed for C/C++ usage on most platforms (Win PCAP etc.).

Be sure this is what you want though: I have seen several projects where raw Ethernet packet interfaces have been used, only for more and more protocol to be put in place for re-transmission and windowing etc. until you end up with your own version of TCP/IP (only one that hasn't been tested by millions of people using Windows/Linux or whatever your platform is). Most Ethernet chips have functions to accelerate TCP/IP stacks these days too: so you will be missing out on that too.




回答2:


Here are examples for C#, maybe you can leverage this. The right code depends on OS and even from the used chips when programming for microcontrollers.



来源:https://stackoverflow.com/questions/6686256/communicate-between-two-systems-using-only-mac-address

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!