简体   繁体   中英

Can we connect to a computer on the same private network using MAC address?

I could connect two computers withing a private network using private IP addresses using socket programming. Is it possible to do the same using MAC addresses?

If it is possible, any example on Java/C/C++ would be appreciated. I couldn't find any helpful posts on the web regarding the same.

UPDATE:

I was curios to know if it's possible to connect to another computer on the same private network just by knowing the MAC address? One logic behind the question could be the IP address assigned to a network device can be different everytime the router is rebooted. So, MAC address sounds more solid option to have for identity in this case.

(Though I am aware MAC address can be changed too.)

MAC addresses are used to identify "physical" entities in a network.

Whereas sockets exist on the IP layer.

MAC addresses denote hardware objects; if you want those objects to communicate, you need to look into the layers above of that. And either you use existing protocols; such as UDP/TCP; or you would have to define your complete own protocol.

In other words: the one and only function of a MAC address is to identify a unique hardware component within the "scope" of the visible network. The MAC address doesn't define any service/protocol that could be used to connect one MAC address endpoint to another one.

So, in short the answer is: no it is not passable.

Yes. IP is one possible layer 2 protocol, but you can run your own protocol on top of ethernet. FCoE, for example, bypasses TCP-IP and runs its own protocol. Since Fibre Channel can support network traffic as well as storage traffic you could theoretically connect up your network using FCoE. With a little programming effort you could add a socket layer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM