MAC vendor lookup: Difference between revisions

Added Visual Basic .NET
(Added Visual Basic .NET)
Line 1,459:
Cisco Systems, Inc
Apple, Inc.
</pre>
 
=={{header|Visual Basic .NET}}==
Based on the C# sample but works with .Netr versions prior to Framework 4.5.<br>
Expects the address to be on the command line, if not specified, it defaults to 88:53:2E:67:07:BE.
<syntaxhighlight lang="vbnet">
' MAC Vendor lookup - based on the C# sample.
 
Imports System
Imports System.Net
 
Module LookupMac
 
Public Sub Main(args() As String)
 
Dim macAddress As String = If(args.Length < 1, "88:53:2E:67:07:BE", args(0))
Dim uri As New Uri("http://api.macvendors.com/" & WebUtility.UrlEncode(macAddress))
Dim wc As New WebClient()
Console.Out.WriteLine(macAddress & " " & wc.DownloadString(uri))
 
End Sub
 
End Module
</syntaxhighlight>
{{out}}
With no address on the command line:
<pre>
88:53:2E:67:07:BE Intel Corporate
</pre>
 
With FC:FB:FB:01:FA:21 on the command line:
<pre>
FC:FB:FB:01:FA:21 Cisco Systems, Inc
</pre>
 
3,028

edits