Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

sockaddr_in6 (Structures)
 
.
Summary
TODO - a short description

C# Definition:

[StructLayout(LayoutKind.Explicit, Size = 28)]

    internal struct sockaddr_in6
    [StructLayout(LayoutKind.Explicit, Size = 16)]
    public struct in6_addr
    {
        [FieldOffset(0)] internal ADDRESS_FAMILIES sin6_family;
        [FieldOffset(2)] internal ushort sin6_port;
        [FieldOffset(4)] internal uint sin6_flowinfo;
        [FieldOffset(8)] internal in6_addr sin6_addr;
        [FieldOffset(24)] internal uint sin6_scope_id;
        [FieldOffset(0)]
        public byte Byte_0;
        [FieldOffset(1)]
        public byte Byte_1;
        [FieldOffset(2)]
        public byte Byte_2;
        [FieldOffset(3)]
        public byte Byte_3;

        internal string Host
        {
        get
        {
            var local = this;
            var length = (uint) 256;
            var builder = new StringBuilder((int) length);
        [FieldOffset(4)]
        public byte Byte_4;
        [FieldOffset(5)]
        public byte Byte_5;
        [FieldOffset(6)]
        public byte Byte_6;
        [FieldOffset(7)]
        public byte Byte_7;

            var data = new WSAData();
            WSAStartup(2, ref data);
            WSAAddressToString(ref local, (uint) Marshal.SizeOf(local), IntPtr.Zero, builder,
                          ref length);
            WSACleanup();
        [FieldOffset(8)]
        public byte Byte_8;
        [FieldOffset(9)]
        public byte Byte_9;
        [FieldOffset(10)]
        public byte Byte_10;
        [FieldOffset(11)]
        public byte Byte_11;

            return builder.ToString().Split(':')[0];
        }
        [FieldOffset(12)]
        public byte Byte_12;
        [FieldOffset(13)]
        public byte Byte_13;
        [FieldOffset(14)]
        public byte Byte_14;
        [FieldOffset(15)]
        public byte Byte_16;

        }
        [FieldOffset(0)]
        public short Word_0;
        [FieldOffset(2)]
        public short Word_1;
        [FieldOffset(4)]
        public short Word_2;
        [FieldOffset(6)]
        public short Word_3;

        internal string Port
        {
        get
        {
            var local = this;
            var length = (uint) 256;
            var builder = new StringBuilder((int) length);
        [FieldOffset(8)]
        public short Word_4;
        [FieldOffset(10)]
        public short Word_5;
        [FieldOffset(12)]
        public short Word_6;
        [FieldOffset(14)]
        public short Word_7;
    }
    [StructLayout(LayoutKind.Explicit, Size = 28)]
    public struct sockaddr_in6
    {
        [FieldOffset(0)]
        public ADDRESS_FAMILIES sin6_family;

            var data = new WSAData();
            WSAStartup(2, ref data);
            WSAAddressToString(ref local, (uint) Marshal.SizeOf(local), IntPtr.Zero, builder,
                          ref length);
            WSACleanup();
        [FieldOffset(2)]
        public ushort sin6_port;

            return builder.ToString().Split(':')[1];
        }
        [FieldOffset(4)]
        public uint sin6_flowinfo;

        }
        [FieldOffset(8)]
        public in6_addr sin6_addr;

        internal static sockaddr_in6 FromString(string host, int port)
        {
        var sockaddr = new sockaddr_in6();
        var lpAddressLength = Marshal.SizeOf(sockaddr);
        WSAStringToAddress(host + ":" + port, EnumLib.ADDRESS_FAMILIES.AF_INET6, IntPtr.Zero,
                          ref sockaddr, ref lpAddressLength);
        return sockaddr;
        }
        [FieldOffset(24)]
        public uint sin6_scope_id;
    }

VB Definition:

Structure sockaddr_in6
   Public TODO
End Structure

User-Defined Field Types:

None.

    [StructLayout(LayoutKind.Explicit, Size = 28)]
    internal struct sockaddr_in6_UNSAFE
    {
        [FieldOffset(0)] internal EnumLib.ADDRESS_FAMILIES sin6_family;
        [FieldOffset(2)] internal ushort sin6_port;
        [FieldOffset(4)] internal uint sin6_flowinfo;
        [FieldOffset(8)] internal in6_addr sin6_addr;
        [FieldOffset(24)] internal uint sin6_scope_id;

Notes:

None.

        internal string Host
        {
        get
        {
            var local = this;
            var length = (uint) 256;
            var builder = new StringBuilder((int) length);

            var data = new WSAData();
            WSAStartup(2, ref data);
            WSAAddressToString(ref local, (uint) Marshal.SizeOf(local), IntPtr.Zero, builder,
                          ref length);
            WSACleanup();

            return builder.ToString().Split(':')[0];
        }

        }

        internal string Port
        {
        get
        {
            var local = this;
            var length = (uint) 256;
            var builder = new StringBuilder((int) length);

            var data = new WSAData();
            WSAStartup(2, ref data);
            WSAAddressToString(ref local, (uint) Marshal.SizeOf(local), IntPtr.Zero, builder,
                          ref length);
            WSACleanup();

            return builder.ToString().Split(':')[1];
        }

        }

        internal static sockaddr_in6 FromString(string host, int port)
        {
        var sockaddr = new sockaddr_in6();
        var lpAddressLength = Marshal.SizeOf(sockaddr);
        WSAStringToAddress(host + ":" + port, EnumLib.ADDRESS_FAMILIES.AF_INET6, IntPtr.Zero,
                          ref sockaddr, ref lpAddressLength);
        return sockaddr;
        }
    }

VB Definition:

Structure sockaddr_in6
   Public TODO
End Structure

User-Defined Field Types:

ADDRESS_FAMILIES

Notes:

None.

Documentation

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions