0

On C# side i'm using System.Net.IPAddress

On C++ side i'm using UINT32 (the result of inet_addr function)

In interface of C++-Cli wrapper what would be better to use?
I've tried to use UINT32 but I don't know how to convert System.Net.IPAddress to proper UINT32 on C# side.

CharlesB
  • 75,315
  • 26
  • 174
  • 199
Oleg Vazhnev
  • 21,122
  • 47
  • 154
  • 286
  • So the real question is how to convert an IPAdress to a 32 bit integer? see http://stackoverflow.com/questions/461742/how-to-convert-an-ipv4-address-into-a-integer-in-c – flup Mar 09 '13 at 18:07
  • @flup if the suggested interface of transffering IPAddress from C# to c++ is 32bit integer then yes. But probably another type is better to be used in cli-wrapper... – Oleg Vazhnev Mar 09 '13 at 18:13
  • There's the matter of bigendian versus little endian, so perhaps you'd rather use a String then? – flup Mar 09 '13 at 18:15
  • 32-bit will only work for IPv4 addresses. – Lloyd Mar 09 '13 at 18:23
  • that's fine to support only IPv4... – Oleg Vazhnev Mar 09 '13 at 18:30

1 Answers1

-1

How to convert an IPv4 address into a integer in C#? Take notice that in C++ (like in C# too) uint32 is really unsigned int. You need to convert IpAdress to integer.

Community
  • 1
  • 1
pt12lol
  • 2,080
  • 1
  • 18
  • 40