Visual FoxPro
Visual FoxPro
Get Local Network Adapter Addresses
See more Socket/SSL/TLS Examples
Demonstrates Socket.GetAdaptersAddresses, which populates a JsonObject with information about local network adapters, including IPv4 addresses, IPv6 addresses, and MAC addresses.
Tip: Code to parse the returned JSON can be generated with Chilkat's online tool at https://tools.chilkat.io/jsonParse.
Background. This provides a portable way to enumerate the host's network interfaces and their addresses.
Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loSocket
LOCAL loJson
LOCAL lcJsonStr
lnSuccess = 0
loSocket = CreateObject('Chilkat.Socket')
* Populate a JsonObject with information about the local network adapters, including IPv4 addresses,
* IPv6 addresses, and MAC addresses.
loJson = CreateObject('Chilkat.JsonObject')
lnSuccess = loSocket.GetAdaptersAddresses(loJson)
IF (lnSuccess = 0) THEN
? loSocket.LastErrorText
RELEASE loSocket
RELEASE loJson
CANCEL
ENDIF
loJson.EmitCompact = 0
lcJsonStr = loJson.Emit()
? lcJsonStr
* JSON parsing code for this result can be generated at Chilkat's online tool:
* https://tools.chilkat.io/jsonParse
RELEASE loSocket
RELEASE loJson