Class SocketAddress

All Implemented Interfaces:
PointerInterface
Direct Known Subclasses:
InetSocketAddress, NativeSocketAddress, UnixSocketAddress

public class SocketAddress extends Object
#GSocketAddress is the equivalent of struct sockaddr in the BSD
sockets API. This is an abstract class; use #GInetSocketAddress
for internet sockets, or #GUnixSocketAddress for UNIX domain sockets.

https://docs.gtk.org/gio/class.SocketAddress.html

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • newFromNativeSocketAddress

      public static SocketAddress newFromNativeSocketAddress(@Nonnull Pointer _native, long len)
      Creates a #GSocketAddress subclass corresponding to the native
      struct sockaddr @native.
      Parameters:
      _native - a pointer to a struct sockaddr
      len - the size of the memory location pointed to by @native
      Returns:
      a new #GSocketAddress if @native could successfully be converted, otherwise %NULL
    • getFamily

      public int getFamily()
      Gets the socket family type of @address.
      Returns:
      the socket family type of @address
    • getNativeSize

      public long getNativeSize()
      Gets the size of @address's native struct sockaddr.
      You can use this to allocate memory to pass to
      g_socket_address_to_native().
      Returns:
      the size of the native struct sockaddr that @address represents
    • toNative

      public boolean toNative(@Nullable Pointer dest, long destlen) throws AllocationError
      Converts a #GSocketAddress to a native struct sockaddr, which can
      be passed to low-level functions like connect() or bind().

      If not enough space is available, a %G_IO_ERROR_NO_SPACE error
      is returned. If the address type is not known on the system
      then a %G_IO_ERROR_NOT_SUPPORTED error is returned.
      Parameters:
      dest - a pointer to a memory location that will contain the native struct sockaddr
      destlen - the size of @dest. Must be at least as large as g_socket_address_get_native_size()
      Returns:
      %TRUE if @dest was filled in, %FALSE on error
      Throws:
      AllocationError
    • asSocketConnectable

      public SocketConnectable asSocketConnectable()
      Implements interface SocketConnectable. Call this to get access to interface functions.
      Returns:
      SocketConnectable
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()