By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,640 Members | 2,167 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,640 IT Pros & Developers. It's quick & easy.

mac address

P: 26
Expand|Select|Wrap|Line Numbers
  1. public static NDIS_802_3_ADDRESS StrToByteArray(string str)
  2.         {
  3.             ASCIIEncoding encoding = new ASCIIEncoding();
  4.             byte[] m = encoding.GetBytes(str);
  5.             NDIS_802_3_ADDRESS mac = new NDIS_802_3_ADDRESS(m);
  6.             return mac;
  7.         }

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
Feb 22 '09 #1
Share this Question
Share on Google+
2 Replies

Expert 5K+
P: 7,872
I am not sure what you are trying to do. NDIS_802_3_ADDRESS 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?
Feb 23 '09 #2

Expert 2.5K+
P: 3,525
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_ADDRESS appears to be a custom type from a custom namespace. Is this where you got it?
Feb 23 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.