|
> Is there any way to tell the MAC address of the client that is connected
> to my RPG program? I need to be able to determine if that client has
> connected previously and I can't use the IP address because of DHCP. I
> am open to other suggestions as well.
You can do that, but bear in mind that the MAC address is only relevant if
your clients will always be on the same ethernet segment as your iSeries
is.
Here's what you'll need to do to get the MAC address:
1) Get the connected computer's IP address. You can use the QDCRDEVD
API with format DEVD0600 to do that.
2) Get the "line name" of your ethernet card. I've always hard-coded
this, since we have only one ethernet card, but I imagine
there's a way to get this with APIs as well? Mines LIN051 :)
3) Call the QtocLstPhyIfcARPTbl API. This lists the ARP table for
a given ethernet card to a UsrSpc. (ARP = Address Resolution
Protocol... an ARP table corresponds MAC addresses with IP
addresses)
4) Loop through the UsrSpc and find the entry that matches the IP
address from step 1. The MAC address will be in the
"Physical address" field of the ARPT0100 format.
Let me know if you need some sample code...
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.