mac address

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • little83
    New Member
    • Feb 2009
    • 26

    #1

    mac address

    Code:
    public static NDIS_802_3_ADDRESS StrToByteArray(string str)
            {
                ASCIIEncoding encoding = new ASCIIEncoding();
                byte[] m = encoding.GetBytes(str);
                NDIS_802_3_ADDRESS mac = new NDIS_802_3_ADDRESS(m);
                return mac;
            }

    U use these method in order to change string to mac address, however the output of that is fixed value 30-30-2D-32-31-2D, whatever the input string

    any ideas
    Last edited by pbmods; Feb 23 '09, 02:20 AM. Reason: Added CODE tags.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    I am not sure what you are trying to do. NDIS_802_3_ADDR ESS does not appear to be a valid .NET structure.
    Also, your MAC address really does not change (special circumstances aside), so why would you expect it to?

    Comment

    • tlhintoq
      Recognized Expert Specialist
      • Mar 2008
      • 3532

      #3
      Ignoring for a moment that the output is to be a MAC address....

      There is a string being passed into the method.
      It gets processed.
      And a new string gets returned.
      In theory, as long as different strings are passed in different strings will be returned out, depending on how the incoming string is processed.

      So my questions to little83 are: What is the string str that you are passing into this method? Where does it come from? What is its format? In what way is it supposed to corolate to a MAC address? Obviously if you pass in "Fred Flintstone" as the str you are expecting a valid MAC back.

      NDIS_802_3_ADDR ESS appears to be a custom type from a custom namespace. Is this where you got it?

      Comment

      Working...