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

socket (ws2_32)
 
.
Summary
TODO - a short description

C# Signature:

[DllImport("ws2_32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern IntPtr socket(ADDRESS_FAMILIES af, SOCKET_TYPE socket_type, PROTOCOL protocol);

VB Signature:

Declare Function socket Lib "ws2_32.dll" (TODO) As TODO

User-Defined Types:

    public enum ADDRESS_FAMILIES : short
    {
        /// <summary>
        /// Unspecified [value = 0].
        /// </summary>
        AF_UNSPEC = 0,
        /// <summary>
        /// Local to host (pipes, portals) [value = 1].
        /// </summary>
        AF_UNIX = 1,
        /// <summary>
        /// Internetwork: UDP, TCP, etc [value = 2].
        /// </summary>
        AF_INET = 2,
        /// <summary>
        /// Arpanet imp addresses [value = 3].
        /// </summary>
        AF_IMPLINK = 3,
        /// <summary>
        /// Pup protocols: e.g. BSP [value = 4].
        /// </summary>
        AF_PUP = 4,
        /// <summary>
        /// Mit CHAOS protocols [value = 5].
        /// </summary>
        AF_CHAOS = 5,
        /// <summary>
        /// XEROX NS protocols [value = 6].
        /// </summary>
        AF_NS = 6,
        /// <summary>
        /// IPX protocols: IPX, SPX, etc [value = 6].
        /// </summary>
        AF_IPX = 6,
        /// <summary>
        /// ISO protocols [value = 7].
        /// </summary>
        AF_ISO = 7,
        /// <summary>
        /// OSI is ISO [value = 7].
        /// </summary>
        AF_OSI = 7,
        /// <summary>
        /// european computer manufacturers [value = 8].
        /// </summary>
        AF_ECMA = 8,
        /// <summary>
        /// datakit protocols [value = 9].
        /// </summary>
        AF_DATAKIT = 9,
        /// <summary>
        /// CCITT protocols, X.25 etc [value = 10].
        /// </summary>
        AF_CCITT = 10,
        /// <summary>
        /// IBM SNA [value = 11].
        /// </summary>
        AF_SNA = 11,
        /// <summary>
        /// DECnet [value = 12].
        /// </summary>
        AF_DECnet = 12,
        /// <summary>
        /// Direct data link interface [value = 13].
        /// </summary>
        AF_DLI = 13,
        /// <summary>
        /// LAT [value = 14].
        /// </summary>
        AF_LAT = 14,
        /// <summary>
        /// NSC Hyperchannel [value = 15].
        /// </summary>
        AF_HYLINK = 15,
        /// <summary>
        /// AppleTalk [value = 16].
        /// </summary>
        AF_APPLETALK = 16,
        /// <summary>
        /// NetBios-style addresses [value = 17].
        /// </summary>
        AF_NETBIOS = 17,
        /// <summary>
        /// VoiceView [value = 18].
        /// </summary>
        AF_VOICEVIEW = 18,
        /// <summary>
        /// Protocols from Firefox [value = 19].
        /// </summary>
        AF_FIREFOX = 19,
        /// <summary>
        /// Somebody is using this! [value = 20].
        /// </summary>
        AF_UNKNOWN1 = 20,
        /// <summary>
        /// Banyan [value = 21].
        /// </summary>
        AF_BAN = 21,
        /// <summary>
        /// Native ATM Services [value = 22].
        /// </summary>
        AF_ATM = 22,
        /// <summary>
        /// Internetwork Version 6 [value = 23].
        /// </summary>
        AF_INET6 = 23,
        /// <summary>
        /// Microsoft Wolfpack [value = 24].
        /// </summary>
        AF_CLUSTER = 24,
        /// <summary>
        /// IEEE 1284.4 WG AF [value = 25].
        /// </summary>
        AF_12844 = 25,
        /// <summary>
        /// IrDA [value = 26].
        /// </summary>
        AF_IRDA = 26,
        /// <summary>
        /// Network Designers OSI &amp; gateway enabled protocols [value = 28].
        /// </summary>
        AF_NETDES = 28,
        /// <summary>
        /// [value = 29].
        /// </summary>
        AF_TCNPROCESS = 29,
        /// <summary>
        /// [value = 30].
        /// </summary>
        AF_TCNMESSAGE = 30,
        /// <summary>
        /// [value = 31].
        /// </summary>
        AF_ICLFXBM = 31
    }
    public enum SOCKET_TYPE : short
    {
        /// <summary>
        /// stream socket
        /// </summary>
        SOCK_STREAM = 1,

    public enum SOCKET_TYPE : short
    {
    /// <summary>
    /// stream socket
    /// </summary>
    SOCK_STREAM = 1,
        /// <summary>
        /// datagram socket
        /// </summary>
        SOCK_DGRAM = 2,

    /// <summary>
    /// datagram socket
    /// </summary>
    SOCK_DGRAM = 2,
        /// <summary>
        /// raw-protocol interface
        /// </summary>
        SOCK_RAW = 3,

    /// <summary>
    /// raw-protocol interface
    /// </summary>
    SOCK_RAW = 3,
        /// <summary>
        /// reliably-delivered message
        /// </summary>
        SOCK_RDM = 4,

    /// <summary>
    /// reliably-delivered message
    /// </summary>
    SOCK_RDM = 4,
        /// <summary>
        /// sequenced packet stream
        /// </summary>
        SOCK_SEQPACKET = 5
    }
    public enum PROTOCOL : short
    {//dummy for IP  
        IPPROTO_IP = 0,
        //control message protocol  
        IPPROTO_ICMP = 1,
        //internet group management protocol  
        IPPROTO_IGMP = 2,
        //gateway^2 (deprecated)  
        IPPROTO_GGP = 3,
        //tcp  
        IPPROTO_TCP = 6,
        //pup  
        IPPROTO_PUP = 12,
        //user datagram protocol  
        IPPROTO_UDP = 17,
        //xns idp  
        IPPROTO_IDP = 22,
        //IPv6  
        IPPROTO_IPV6 = 41,
        //UNOFFICIAL net disk proto  
        IPPROTO_ND = 77,

    /// <summary>
    /// sequenced packet stream
    /// </summary>
    SOCK_SEQPACKET = 5
    }

VB Signature:

        IPPROTO_ICLFXBM = 78,
        //raw IP packet  
        IPPROTO_RAW = 255,

        IPPROTO_MAX = 256
    }

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Documentation
SOCKET_TYPE on MSDN
Documentation
socket on MSDN

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

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