IPAddress creation

  • Thread starter Thread starter MG
  • Start date Start date
M

MG

Hello,

I try to create IPAddress object from array of bytes and it always throws
exception,
even when array of bytes is taken from proper IPAddress object:

IPAddress lAddress=IPAddress.Parse("1.2.3.4");
byte[] lBytes=lAddress.GetAddressBytes();
IPAddress lNewAddress=new IPAddress(lBytes);

Has anyone encountered the problem?
Am I doing something wrong ??
(Im usingFramework 1.1)
 
MG,

What is the exception that is thrown? Also, what are the contents of
the byte array that you are passing in? You should have a 16-element byte
array. The reason for this is to account for the fact that IP addresses are
being widened at some point in time.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top