Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than Structures, prefix the name with the module name and a period.
SOCKADDR (Structures)
.
C# Definition:
// WinsockSockAddr takes an IPAddress of IPEndpoint on creation, then provides a
// pinned PSOCKADDR to be used for async PInvoke calls. The owner and pending
// async calls may reference the same instance at the same time, and have
// different independent needs with regards to the lifetime of the pinned
// PSOCKADDR. So WinsockSockAddr guarantees the pinned copy is available so
// long as the WinsockSockAddr instance owning that pinned copy is referenced.
// NOTENOTE: System.Net.Endpoint.Serialize will provide a System.Net.SocketAddress
// which mostly fulfills the same use as the class below. It does not pin the
// result though. Consider passing the result of System.Net.Endpoint.Serialize()
// as X to GCHandle.Alloc(X, GCHandleType.Pinned) instead of picking up the
// entire class below.
public struct sockaddr_in
{
public ADDRESS_FAMILIES sin_family;
public ushort sin_port;
public in_addr sin_addr;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public byte[] sin_zero;
}
public struct in_addr
{
[FieldOffset(0)]
public byte s_b1;
[FieldOffset(1)]
public byte s_b2;
[FieldOffset(2)]
public byte s_b3;
[FieldOffset(3)]
public byte s_b4;
[FieldOffset(0)]
public ushort s_w1;
[FieldOffset(2)]
public ushort s_w2;
[FieldOffset(0)]
public uint S_addr;
/// <summary>
/// can be used for most tcp & ip code
/// </summary>
public uint s_addr { get { return S_addr; } }
/// <summary>
/// host on imp
/// </summary>
public byte s_host { get { return s_b2; } }
/// <summary>
/// network
/// </summary>
public byte s_net { get { return s_b1; } }
/// <summary>
/// imp
/// </summary>
public ushort s_imp { get { return s_w2; } }
/// <summary>
/// imp #
/// </summary>
public byte s_impno { get { return s_b4; } }
/// <summary>
/// logical host
/// </summary>
public byte s_lh { get { return s_b3; } }
}
[StructLayout(LayoutKind.Sequential)]
struct SOCKADDR_IN
{
public Int16 _family;
public Int16 _port;
public Byte _addr0;
public Byte _addr1;
public Byte _addr2;
public Byte _addr3;
public Int32 _nothing;
}
static readonly int SIZEOF_SOCKADDR_IN = Marshal.SizeOf(typeof(SOCKADDR_IN));
[StructLayout(LayoutKind.Sequential)]
struct SOCKADDR_IN6
{
public Int16 _family;
public Int16 _port;
public Int32 _flowInfo;
public Byte _addr0;
public Byte _addr1;
public Byte _addr2;
public Byte _addr3;
public Byte _addr4;
public Byte _addr5;
public Byte _addr6;
public Byte _addr7;
public Byte _addr8;
public Byte _addr9;
public Byte _addr10;
public Byte _addr11;
public Byte _addr12;
public Byte _addr13;
public Byte _addr14;
public Byte _addr15;
public Int32 _scopeID;
}
static readonly int SIZEOF_SOCKADDR_IN6 = Marshal.SizeOf(typeof(SOCKADDR_IN6));
// Depending on the family type of address represented, either a SOCKADDR_IN
// or a SOCKADDR_IN6 will be referenced by _addr. We'll pin the same object
// to _pinAddr, and finally keep a IntPtr to the alloc.
object _addr;
GCHandle _pinAddr;
IntPtr _pAddr;
public WinsockSockAddr(IPEndPoint source)
: this(source.Address, (short)source.Port)
{
}
public WinsockSockAddr(IPAddress source)
: this(source, 0)
{
}
public WinsockSockAddr(IPAddress source, short port)
{
_pAddr = (IntPtr)0;