Link to home
Start Free TrialLog in
Avatar of sathya_sk
sathya_sk

asked on

API function to find MAC address in powerbuilder

API function to find MAC address in powerbuilder
Avatar of sathya_sk
sathya_sk

ASKER

API function to find MAC address in powerbuilder
what do you mean by mac address
Do you want to enumerate all MAC Id's available on the system, or a mac ID for a specific IP , or a mac ID for a specific adapter?
I don't know if there is an API but let me show you what I did to find MAC address for an IP.

I have a GetMAC.BAT file where I send a PING to IP address I want to check, next I use ARP command to get MAC address, result is saved to a file that is opened in PB for processing.

You can check what I said in a DOS screen:


1. Make Ping so your computer will ask for IP to router or other computers

C:\PING 132.1.1.2
Haciendo ping a 132.1.1.2 con 32 bytes de datos:

Respuesta desde 132.1.1.2: bytes=32 tiempo<1m TTL=128
Respuesta desde 132.1.1.2: bytes=32 tiempo<1m TTL=128
Respuesta desde 132.1.1.2: bytes=32 tiempo<1m TTL=128
Respuesta desde 132.1.1.2: bytes=32 tiempo<1m TTL=128

Estadísticas de ping para 132.1.1.2:
    Paquetes: enviados = 4, recibidos = 4, perdidos = 0
    (0% perdidos),
Tiempos aproximados de ida y vuelta en milisegundos:
    Mínimo = 0ms, Máximo = 0ms, Media = 0ms


2. Ask for Phisycal address in ARP table

c:\ARP -a 132.1.1.2

Interfaz: 132.1.2.111 --- 0x10003
  Dirección IP          Dirección física      Tipo
  132.1.1.2             00-10-5a-e3-e4-f1     dinámico


[To Save into a file]

c:\ARP -a 132.1.1.2  > c:\MyFile.Txt



Now in PB open MyFile.txt and process it to find the address you are looking for.

132.1.1.1   =   00-10-5a-e3-e4-f1

Regards,

BerX
ASKER CERTIFIED SOLUTION
Avatar of sajuks
sajuks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How to find Network id in powerbuilder5.0 ?
Check http://www.funcky.com/ .
Got lots of features which you can use.