仅使用 MAC 地址在两个系统之间进行通信 [英] Communicate between two systems using only MAC address

查看:103
本文介绍了仅使用 MAC 地址在两个系统之间进行通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用 C 程序(不使用 IP 地址)仅使用 MAC 地址在两个系统之间进行通信.我认为这是原始的以太网通信.我的要求是仅使用 MAC 地址将数据从客户端发送到服务器.这可能可以通过创建我们自己的原始以太网框架来完成.

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.

请帮我解决这个问题.如果有人用C写过代码,请分享.

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

此链接可能对您有所帮助,http://aschauf.landshut.org/fh/linux/udp_vs_raw/ch01s03.html

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

推荐答案

libpcap 库允许您组装原始以太网数据包并将它们直接发送到适配器:最困难的部分是发现正确的适配器.这是专为在大多数平台(Win PCAP 等)上使用 C/C++ 而设计的.

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.).

请确保这是您想要的:我已经看到了几个使用原始以太网数据包接口的项目,只是为了重新传输和窗口等越来越多的协议,直到您最终你自己的 TCP/IP 版本(只有一个没有被数百万人使用 Windows/Linux 或任何你的平台测试过).如今,大多数以太网芯片也具有加速 TCP/IP 堆栈的功能:因此您也会错过这一点.

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.

这篇关于仅使用 MAC 地址在两个系统之间进行通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆