MAC vendor lookup: Difference between revisions

no edit summary
m (→‎{{header|APL}}: Pair 1↓ with 1↑ instead of [1] for better symmetry.)
No edit summary
Line 1,369:
Spacing next request...
00-40-ae-04-87-86 -> DELTA CONTROLS, INC.
</pre>
 
import net.http
import time
 
=={{header|Vlang}}==
<lang vlang>const macs =
('
FC-A1-3E
FC:FB:FB:01:FA:21
D4:F4:6F:C9:EF:8D
')
 
fn main() {
for line in macs.split('\n') {
if line !='' {
println(mac_lookup(line))
time.sleep(2 * time.second) // considerate delay between attempts
}
}
}
 
fn mac_lookup(mac string) string {
resp := http.get("http://api.macvendors.com/" + mac) or {println('No data from server') return ''}
return resp.body.str()
}</lang>
 
{{out}}
<pre>
Samsung Electronics Co.,Ltd
Cisco Systems, Inc
Apple, Inc.
</pre>
 
291

edits