Interface Winsock

  • All Superinterfaces:
    com.sun.jna.AltCallingConvention, com.sun.jna.Library, com.sun.jna.win32.StdCall, com.sun.jna.win32.StdCallLibrary

    public interface Winsock
    extends com.sun.jna.win32.StdCallLibrary
    Interface definitions for WS2_32.dll.
    Since:
    0.40
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.sun.jna.Library

        com.sun.jna.Library.Handler
      • Nested classes/interfaces inherited from interface com.sun.jna.win32.StdCallLibrary

        com.sun.jna.win32.StdCallLibrary.StdCallCallback
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int AF_INET
      The Internet Protocol version 4 (IPv4) address family.
      static Winsock INSTANCE
      Instance.
      static int INVALID_SOCKET
      Invalid socket descriptor.
      static int IPPROTO_TCP
      The Transmission Control Protocol (TCP).
      static int SOCK_STREAM
      A socket type that provides sequenced, reliable, two-way, connection-based byte streams with an OOB data transmission mechanism.
      static int SOCKET_ERROR
      Status returned on errors with socket.
      static short WINSOCK_VERSION_2_2
      Winsock version.
      • Fields inherited from interface com.sun.jna.Library

        OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_SYMBOL_PROVIDER, OPTION_TYPE_MAPPER
      • Fields inherited from interface com.sun.jna.win32.StdCallLibrary

        FUNCTION_MAPPER, STDCALL_CONVENTION
    • Field Detail

      • INSTANCE

        static final Winsock INSTANCE
        Instance.
      • WINSOCK_VERSION_2_2

        static final short WINSOCK_VERSION_2_2
        Winsock version.
        See Also:
        Constant Field Values
      • AF_INET

        static final int AF_INET
        The Internet Protocol version 4 (IPv4) address family.
        See Also:
        Constant Field Values
      • SOCK_STREAM

        static final int SOCK_STREAM
        A socket type that provides sequenced, reliable, two-way, connection-based byte streams with an OOB data transmission mechanism. This socket type uses the TCP for the Internet address family (AF_INET or AF_INET6).
        See Also:
        Constant Field Values
      • IPPROTO_TCP

        static final int IPPROTO_TCP
        The Transmission Control Protocol (TCP). This is a possible value when the af parameter is AF_INET or AF_INET6 and the type parameter is SOCK_STREAM.
        See Also:
        Constant Field Values
      • INVALID_SOCKET

        static final int INVALID_SOCKET
        Invalid socket descriptor.
        See Also:
        Constant Field Values
      • SOCKET_ERROR

        static final int SOCKET_ERROR
        Status returned on errors with socket.
        See Also:
        Constant Field Values
    • Method Detail

      • WSAStartup

        int WSAStartup​(short version,
                       WSAStartupFuncCall.WSAData data)
        Initializes winsock usage by DLL process.
        Parameters:
        version - Highest Windows socket specification version.
        data - Data with info about socket structure
        Returns:
        Zero on success, error code on error.
      • WSACleanup

        int WSACleanup()
        Stops usage of Winsock 2 by DLL.
        Returns:
        Zero on success, SOCKET_ERROR on error.
      • socket

        int socket​(int domain,
                   int type,
                   int protocol)
        Creates a socket.
        Parameters:
        domain - Socket domain
        type - Socket type
        protocol - Socket protocol
        Returns:
        Socket descriptor
      • closesocket

        int closesocket​(int socket)
        Closes a socket.
        Parameters:
        socket - Socket descriptor
        Returns:
        Zero on success, otherwise, a value of SOCKET_ERROR is returned.