473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

how to find mac address of a remote computer?

Jay
I need to write a program to find mac address of a remote computer, is
this possible? How?
Nov 13 '05 #1
13 29083
ja*****@hotmail.com (Jay) wrote in
news:6d**************************@posting.google.c om:
I need to write a program to find mac address of a remote computer, is
this possible? How?


You cannot do this without platform-specific code which is off-topic here.
The C language does not provide networking support.

--
- Mark ->
--
Nov 13 '05 #2
Jay wrote:

I need to write a program to find mac address of a remote computer, is
this possible? How?


arp?

/david

--
Andre, a simple peasant, had only one thing on his mind as he crept
along the East wall: 'Andre, creep... Andre, creep... Andre, creep.'
-- unknown
Nov 13 '05 #3
Jay wrote:
I need to write a program to find mac address of a remote computer, is
this possible? How?


It is possible, but you don't need to write a program, since
there is http://www.tcpdump.org.

Jirka

Nov 13 '05 #4
>I need to write a program to find mac address of a remote computer, is
this possible? How?


Ping between both computers and run "arp" on one side if you got Linux or
similar.
Nov 13 '05 #5
In <Pi*******************************@yvahk01.tjqt.qr > Jan Engelhardt <je*****@linux01.gwdg.de> writes:
I need to write a program to find mac address of a remote computer, is
this possible? How?


Ping between both computers and run "arp" on one side if you got Linux or
similar.


And you'll get the MAC address of the router, if the machines are not on
the same subnet.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #6
Jay wrote:
I need to write a program to find mac address of a remote computer, is
this possible? How?


#include <stdio.h>

int main(void)
{
char mac_address[257];

printf("Enter the MAC address of the remote computer: ");
fflush(stdin);

fgets(mac_address,sizeof(mac_address), stdin);
if (mac_address[strlen(mac_address) - 1] == '\n')
mac_address[strlen(mac_address) - 1] = 0;

printf("The MAC address of the remote computer is %s\n",
mac_address);

return 0;
}

--
Lew Pitcher

Master Codewright and JOAT-in-training
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.

Nov 13 '05 #7
Lew Pitcher <lp******@sympatico.ca> scribbled the following:
Jay wrote:
I need to write a program to find mac address of a remote computer, is
this possible? How?
#include <stdio.h> int main(void)
{
char mac_address[257]; printf("Enter the MAC address of the remote computer: ");
fflush(stdin); ^^^^^^^^^^^^^
Undefined behaviour. Because of this, the program might completely
fail to display the given MAC address.
fgets(mac_address,sizeof(mac_address), stdin);
if (mac_address[strlen(mac_address) - 1] == '\n')
mac_address[strlen(mac_address) - 1] = 0; printf("The MAC address of the remote computer is %s\n",
mac_address); return 0;
}


--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"Insanity is to be shared."
- Tailgunner
Nov 13 '05 #8
Joona I Palaste wrote:
Lew Pitcher <lp******@sympatico.ca> scribbled the following:
Jay wrote:
I need to write a program to find mac address of a remote computer, is
this possible? How?
printf("Enter the MAC address of the remote computer: ");
fflush(stdin);


^^^^^^^^^^^^^
Undefined behaviour. Because of this, the program might completely
fail to display the given MAC address.


Da*n, caught out by a typo. Of course, I meant
fflush(stdout);
but I transcribed it incorrectly.
--

Lew Pitcher, IT Consultant, Application Architecture
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed here are my own, not my employer's)

Nov 13 '05 #9

Originally posted by Jay
I need to write a program to find mac address of a remote computer, is this possible? How?
If you can run a remote shell on the machine, you can run ifconfig and
parse the result with grep from the standard output.
rsh remoteHost sbin/ifconfig | grep "^eth0"


eth0 Link encap:Ethernet HWaddr 00:0D:29:A8:80:44

You can use cut or awk to extract the MAC hardware address.
--
PeterW
Posted via http://dbforums.com
Nov 13 '05 #10
PeterW <me*********@dbforums.com> scribbled the following:
Originally posted by Jay
I need to write a program to find mac address of a remote computer, is
this possible? How?
If you can run a remote shell on the machine, you can run ifconfig and
parse the result with grep from the standard output. rsh remoteHost sbin/ifconfig | grep "^eth0"

eth0 Link encap:Ethernet HWaddr 00:0D:29:A8:80:44

You can use cut or awk to extract the MAC hardware address.


Which part of this had anything at all to do with C?

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"That's no raisin - it's an ALIEN!"
- Tourist in MTV's Oddities
Nov 13 '05 #11

"Joona I Palaste" <pa*****@cc.helsinki.fi> wrote in message
news:bn**********@oravannahka.helsinki.fi...
PeterW <me*********@dbforums.com> scribbled the following:
Originally posted by Jay
I need to write a program to find mac address of a remote computer, is
this possible? How?
If you can run a remote shell on the machine, you can run ifconfig and
parse the result with grep from the standard output.

rsh remoteHost sbin/ifconfig | grep "^eth0"

eth0 Link encap:Ethernet HWaddr 00:0D:29:A8:80:44

You can use cut or awk to extract the MAC hardware address.


Which part of this had anything at all to do with C?


ifconfig, grep, cut, and awk are all C programs.

-- glen
Nov 13 '05 #12
Glen Herrmannsfeldt <ga*@ugcs.caltech.edu> scribbled the following:
"Joona I Palaste" <pa*****@cc.helsinki.fi> wrote in message
news:bn**********@oravannahka.helsinki.fi...
PeterW <me*********@dbforums.com> scribbled the following:
> Originally posted by Jay
>> I need to write a program to find mac address of a remote computer, is
>> this possible? How?
> If you can run a remote shell on the machine, you can run ifconfig and
> parse the result with grep from the standard output.

>> rsh remoteHost sbin/ifconfig | grep "^eth0"
> eth0 Link encap:Ethernet HWaddr 00:0D:29:A8:80:44

> You can use cut or awk to extract the MAC hardware address.


Which part of this had anything at all to do with C?

ifconfig, grep, cut, and awk are all C programs.


But this newsgroup is about C, not C programs.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Immanuel Kant but Genghis Khan."
- The Official Graffitist's Handbook
Nov 13 '05 #13
On Mon, 27 Oct 2003 19:52:05 GMT, in comp.lang.c , "Glen
Herrmannsfeldt" <ga*@ugcs.caltech.edu> wrote:

"Joona I Palaste" <pa*****@cc.helsinki.fi> wrote in message

Which part of this had anything at all to do with C?


ifconfig, grep, cut, and awk are all C programs.


Says who? Maybe they're written in Fortran on the OP's platform.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #14

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

Similar topics

0
by: Pieter Linden | last post by:
Okay, the basic plan: 1. Call EnumerateServers to return an array of all the computers on the network. available at: http://datafast.cjb.net/ 2. Resolve the HostNames into IP Addresses....
1
by: Chidvilas | last post by:
// Get all processes running on the remote computer. Process remoteAll = Process.GetProcesses("XYZ"); when I am exectuing the above code, it is giving excetpion saying "Couldn't get process...
0
by: py | last post by:
I am trying to execute a batch script on a remote computer. The batch script looks like: @echo off start c:\python24\python.exe c:\a_script.py Here's the setup: Computer A (my computer),...
2
by: schaf | last post by:
Hi Ng ! I'm a little confused because of my application. I need to access a file in the path C:\Temp\test.txt on a computer in the same network. Now I just know the IP address of this PC. Is it...
7
by: haleem4us | last post by:
How to find the MAC address of a remote computer from my computer,through my computer command prompt.
5
by: Sin Jeong-hun | last post by:
I need to read some registry keys of a remote computer. The key will be any key users provide. (For example : HKEY_CURRENT_USER\SOFTWARE \MyGame) I found that there was a handy method called...
3
by: Tracid83 | last post by:
Hi, I would like to enumerate user from remote computer connected to network. I don't use wmi service because all service necessary don't start. I just know IP address and Netbios name. Do you...
3
by: gsherp | last post by:
I am trying to determine the ip address of a remote computer accessing my webpage. I do this to determine if the user if logged on elsewhere. If so, the server will reject actions from the previous...
0
by: pawan tiwari | last post by:
please tell me the code for finding ip address of remote computer by its computer name
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.