Re: Re: in_addr in iphlp.cs

Home Forums Discussions Support Portal in_addr in iphlp.cs Re: Re: in_addr in iphlp.cs

#6792

bakhtiar
Participant

Hi;

As the in_addr struct is not availabile in iphlp.cs, this is for those who wants to use this struct in c#.

[StructLayout(LayoutKind.Auto)]

public struct sb
{
public byte s_b1, s_b2, s_b3, s_b4;
}

[StructLayout(LayoutKind.Auto)]

public struct sw
{
public ushort s_w1, s_w2;
}

[StructLayout(LayoutKind.Explicit, Size = 4)]
public struct in_addr
{
[FieldOffset(0)]
public sb S_un_b;
[FieldOffset(0)]
public sw S_un_w;
[FieldOffset(0)]
public uint S_addr;
}