vb.net - What's the most efficient way to find if a mac address is in range? -
I have a large range of MAC address wires if they are in a certain range, then on a certain case statement Want to go For example, "78: A1: 83: 24: 00: 00 to 78: A1: 83: 24: 0F: FF"
I have my code Is running so that it removes the last two hex and selects as below:
'The last three characters are Mac = Mac. Remmand () Mac = Mac. Springing (0, mac. Length - 3) 78: A1: 83: 40: 00 "," 78: 1: 83: 40: 01 "," 78: 1: 83: 40: 02 "," 78: A 1: 83: 40: 78 "A78: A1: 83: 40: 78: A1: 83: 40: 0A," 78: A1: 83: 40: 7 "," 78: 1: 83 But it seems like "VP-1" "40: 08", "78: 1: 83: 40: 09", "78: 0b" That I am wasting space What's the better way to do this?
A mac address is nothing more than the number represented by 6 bytes written in hexadecimal form
Therefore, by changing the lower and upper limit of the MAC address, you can get a manageable range of values to check with the single IF
sub main slow lowRange = " 78: A1: 83: 24: 40:00 "Dim Uppercase =" 78: A1: 83: 24: 40: FF "Dim Startwall = Gate Value (Low Crange) Dim Endvol = Gateway Leu (Aprenj) console. Virylline (StartWell) '132635085258752 console.lightline (endville)' 13263508525 9 007 dim MacTouch = "78: A1: 83: 24: 40: B" Dim Checkwall = GateValue (MacToCak) console.lightline (checkwick) '132635085258928 if Check Val & gt; = StartWell and also check val & lt; = End Val ', then the VP-1 console WriteLine ("in the category") ends and if the SUB Function Gateveli (Mac in the form of strings) is as long as the slow clearText = mac.Replace (":", "") . Tri Force (Clear Text, Numbers, All Hoax Species, Culture Info. Inversion Culture, Results) Return Results Termination Function N ow, as an example to avoid a long list If you can use a dictionary in your categories and then apply a simple to find your categories for each argument
The new main dictionary in the form of a new dictionary (string, Macaron H) () DC Ed ("VP-1", New MacKenzie ()) {Lower: "78: A1: 83: 24: 40: 00", .Upper = "78: A1: 83: 24: 40: FF"}) {/. Dcd ("VP-2", New Macrene ()) 83: 24: 41: FF "}) dc.Add (78 = 1: 83: 24: 41: 00",. High = "78: A1" "VP-3", with the new MacRange (). Lower = "78: A1: 83: 24: 42: 00", .Upper = "78: A1: 83: 24: 42: FF"}) = '' Dim Maitrocokechek = "78: A1: 83: 24: 42: B" Dim Checkwall = GateValue ('Mascoscack') 'Low Lower = GateValue (K. Rev. Lover)' for every Kashmir in DC 'Dim Upper = Gatevalue (K.V.U.U.) 'if checkVal & gt; = decreases and also check valve & lt; = upper' result = KKA 'exit for' end ' The 'Console WriteLine' (result) 'VP3' can be transformed into this LINQ expression. Dim M = DC. FirstOther Default (Function (X) Checkvalue = GetValue (x.Value. Lower) and also _checklowlt = GetValue (x.Value.Upper)) If not I do not have any console then. Light Line (Mk) 'VP3 Ales Console.Prakashline ("No Range Found ") End And End And SubSource Class Mackenge Public Lower String String And Class Function GetValue (MacC Dim-clear text = Mac until as long as the upper as a string). Replay (":", "") Longer Length Results Tray purse (clear text, numbers, allhoex spifier, culture info. Invertary culture, results) return result finished function
Comments
Post a Comment