Sample code for 30+ languages & platforms
Visual Basic 6.0

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 Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim socket As New ChilkatSocket

'  Populate a JsonObject with information about the local network adapters, including IPv4 addresses,
'  IPv6 addresses, and MAC addresses.
Dim json As New ChilkatJsonObject
success = socket.GetAdaptersAddresses(json)
If (success = 0) Then
    Debug.Print socket.LastErrorText
    Exit Sub
End If

json.EmitCompact = 0
Dim jsonStr As String
jsonStr = json.Emit()
Debug.Print jsonStr
'  JSON parsing code for this result can be generated at Chilkat's online tool:
'  https://tools.chilkat.io/jsonParse