Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
I am new to socket programming, i want to interface with controller using mac address(since controller does not have its own IP address), so please send a reference example in vc++ mfc(windows)
Thanks in Advance..!!!

What I have tried:

I am new to socket programming, i want to interface with controller using mac address(since controller does not have its own IP address), so please send a reference example in vc++ mfc(windows)
Thanks in Advance..!!!
Posted
Comments
Richard MacCutchan 13-Feb-16 6:56am    
Sockets use IP addresses. And if you want samples and/or references, you are expected to search for them yourself.

As Richard pointed out, if you want to do socket programming then you have to use IP addresses (or hostnames, and anyway, you haven't to worry about the IP address assigned to your own ethernet card). In order to start with socket programming you have to read the f#*?+° (fantastic) documentation: Getting Started with Winsock (Windows)[^].
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 13-Feb-16 11:26am    
5ed.
—SA
CPallini 13-Feb-16 15:44pm    
Thank you, Sergey.
You obviously have no idea what a MAC address is or what it's used for.

You can NOT use a MAC address to talk to a device from your application. It is a hardware address used to uniquely identify a device on a physical network segment and ensure a physical signal gets to the correct device on the "wire". It sits between the network layer (transmission protocols like TCP/IP, IPX, AppleTalk, ...) and the physical layer (putting data on "the wire" and decoding the signals from it.)

Want you want to do (use sockets with MAC addresses) is not possible. Communication using Socket programming does not go down that far in the OSI model.

The device MUST have some other addressing scheme on it (be it TCP/IP, IPX, or whatever) because a MAC address can not be used by any application level communication library. Consult the documentation on the device to find out what that is.
 
Share this answer
 
You can use raw socket programming to exchange packets on low level using Ethernet protocol.
Ethernet use a binary address unique for each comm card made of 6 octects named MAC, that is the short for Media Access Control address, a hardware address that uniquely identifies each node of a network under IEEE-802 networks (MAC sublayer of OSI Data Link Control (DLC) layer).
Use of raw socket is restricted because of the possibility to intercept and/or modify comm packets. For this reason under linux raw sockets are allowed only as superuser (root), and under Windows raw sockets are disabled since XP-SP2. To use them you need a special driver code like winpcap[^].
Just google for around for ethernet comm or raw sockets and you'll find some info.
Just 2 sites:
Raw socket programming on windows with winsock[^] and RAW ethernet[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900