473,503 Members | 1,643 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting physical address/ MACID of network device

Hi,

I am using an asynchronous socket server to allow comms between multiple
clients and my server. I know how to obtain the IPAddress of the client
(network device) as shown below :-

string sensorIPAddress =
((IPEndPoint)handler.RemoteEndPoint).Address.ToStr ing();

but what I would like to obtain is the physical/MACID of the client.

Does anyone know how I can do this?

Thanks
Macca
Jun 7 '06 #1
4 7270
The MACAddress of a client is not transmitted via normal socket operations,
unless you put in specific code on the client to retrieve and send this.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Macca" wrote:
Hi,

I am using an asynchronous socket server to allow comms between multiple
clients and my server. I know how to obtain the IPAddress of the client
(network device) as shown below :-

string sensorIPAddress =
((IPEndPoint)handler.RemoteEndPoint).Address.ToStr ing();

but what I would like to obtain is the physical/MACID of the client.

Does anyone know how I can do this?

Thanks
Macca

Jun 7 '06 #2

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:B9**********************************@microsof t.com...
The MACAddress of a client is not transmitted via normal socket
operations,
unless you put in specific code on the client to retrieve and send this.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


Interesting. I have seen on routers that run as DHCP servers obtain the
client's mac address/id. How do they do this when they don't have any
software installed on the clients machine? Maybe it's just sent when the
DHCP server hands out the address...otherwise, how would the router know
which computer is what? :)

I dunno, just wonderin'.

Mythran

Jun 7 '06 #3
Mythran wrote:

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in
message news:B9**********************************@microsof t.com...
The MACAddress of a client is not transmitted via normal socket
operations,
unless you put in specific code on the client to retrieve and send this.
Peter
....
Interesting. I have seen on routers that run as DHCP servers obtain the
client's mac address/id. How do they do this when they don't have any
software installed on the clients machine? Maybe it's just sent when
the DHCP server hands out the address...otherwise, how would the router
know which computer is what? :)

I dunno, just wonderin'.

....

MAC address exists at lower level (protocol stack). Sockets deal with IP
addresses (usually). MAC address is only known at local area network
where broadcast can travel (on the same broadcast domain). IOW, socket
does not have to deal with MAC address, somebody else will resolve
proper MAC address if needed. That is done by ARP protocol (address
resolution protocol). It is part of standard TCP/IP protocol stack that
is installed on windows.

If you type "arp -a" at command prompt, you'll see cached MAC addresses
and it's mapping to IP addresses.

Routers don't need anything on client machine to get MAC address, as it
is contained in every packet received from client and it can be parsed.

Please not that if packet comes through router, it's MAC address will be
MAC address of routers interface, not remote client. Also, IP address
that you get from socket may not be IP address of client, it may be
changed by NAT. It is always bad idea to add logic based on IP address
you obtained from socket.

Regards,
Goran
Jun 7 '06 #4
The MAC address is not available in the TCP protocol, it is through lower
level protocols in the communications stack. There are ways of getting the
MAC address, but you'll have to use Win32 API calls to do it. There are no
..NET Framework objects which expose it.

Also, you should know that MAC addresses are typically not routable and do
not survive hops across routers. If you are trying to grab the MAC address
of a machine somewhere over the Internet, you're not likely to get it.
You'll probably just get the MAC address of the nearest router.

-dM
"Mythran" wrote:

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:B9**********************************@microsof t.com...
The MACAddress of a client is not transmitted via normal socket
operations,
unless you put in specific code on the client to retrieve and send this.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


Interesting. I have seen on routers that run as DHCP servers obtain the
client's mac address/id. How do they do this when they don't have any
software installed on the clients machine? Maybe it's just sent when the
DHCP server hands out the address...otherwise, how would the router know
which computer is what? :)

I dunno, just wonderin'.

Mythran

Jun 7 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1988
by: Verde | last post by:
I know this is somewhat OT, but don't know where else to ask: How can I discover the rough physical location of an IP address? By "rough physical location" I'm thinking at least country, and...
8
10370
by: MrNobody | last post by:
I need to find out the IP address of my local network on the WAN. There is alot of information on getting my local machine IP address but I can't find anything for getting the IP address my network...
5
11134
by: Paul Bromley | last post by:
How do I know which IP address is active?? I have created the following class and this works well, but the first address it obtains on my machine is not the active one - in fact I do not know...
1
1628
by: ananth | last post by:
Hi All, I am new to visual Basic 2005 and i have a project where in i have to get the List of installed Softwares available on the PC,List of Installed Hardware ,List of network...
3
3982
by: john | last post by:
I would like to view physical memory that is mapped to a pci board. I am using a tool called WinIO to try to create a virtual address to that physical memory. It works for both read and write of...
11
3358
by: !truth | last post by:
Hi, i feel confused about the following program, and it's works to get a pointer-member's address. #define NETDEV_ALIGN 32 #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) ...
6
7007
by: Nicolas Noakes | last post by:
Hello, I would like to convert to following process to code. Any advice is welcome. I have a hardware device which requires the this procedure to set it's IP address. First create an static...
1
1369
by: DeepikaRao | last post by:
Hi. Iam able to get macid of server machine using javascript, but iam not able to get clients macid. can anyone help me out. Thanks
1
7435
by: Pioneer | last post by:
Hi, I need to get MAC address/physical ip address of machine. I am using below code: ManagementClass mc = new ManagementClass("Win32_NetworkAdapter"); foreach (ManagementObject mo in...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7084
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5013
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.