MAC vendor lookup: Difference between revisions

no edit summary
imported>Brie
(Add Nu)
No edit summary
Line 186:
{{out}}
<pre>Hon Hai Precision Ind. Co.,Ltd.</pre>
 
=={{header|BBCBASIC}}==
DIM Block% 599 : REM Memory buffer to receive GET info
INSTALL @lib$ + "SOCKLIB" : PROC_initsockets
 
READ Mac$
WHILE Mac$ > ""
WAIT 100 : REM 1 sec pause to avoid 'Too Many Requests' errors
Socket=FN_tcpconnect("api.macvendors.com", "80")
I%=FN_writelinesocket(Socket, "GET /" + Mac$ + " HTTP/1.0")
I%=FN_writelinesocket(Socket, "")
REPEAT N%=FN_readsocket(Socket, Block%, 600) UNTIL N% > 0
PROC_closesocket(Socket)
PRINT Mac$ TAB(24);
CASE LEFT$($(Block% + 9), 3) OF
WHEN "200"
Block%?N%=0 : REM Add terminating 0x00
REPEAT N%-=1 UNTIL Block%?N% < 32 : REM Leave only last line
PRINT $$(Block% + N% + 1) : REM Print string from memory
WHEN "404"
PRINT "N/A"
OTHERWISE
PRINT "ERROR"
ENDCASE
READ Mac$
ENDWHILE
 
PROC_exitsockets
END
 
DATA 88:53:2E:67:07:BE, FC:FB:FB:01:FA:21, D4:F4:6F:C9:EF:8D, 10-11-22-33-44-55,
{{out}}
<pre>
88:53:2E:67:07:BE Intel Corporate
FC:FB:FB:01:FA:21 Cisco Systems, Inc
D4:F4:6F:C9:EF:8D Apple, Inc.
10-11-22-33-44-55 N/A
</pre>
 
=={{header|C}}==
70

edits