Class SocketUtils

java.lang.Object
io.netty.util.internal.SocketUtils

public final class SocketUtils extends java.lang.Object
Provides socket operations with privileges enabled. This is necessary for applications that use the SecurityManager to restrict SocketPermission to their application. By asserting that these operations are privileged, the operations can proceed even if some code in the calling chain lacks the appropriate SocketPermission.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final java.util.Enumeration<java.lang.Object>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static java.nio.channels.SocketChannel
    accept(java.nio.channels.ServerSocketChannel serverSocketChannel)
     
    static java.net.InetAddress
    addressByName(java.lang.String hostname)
     
    static java.util.Enumeration<java.net.InetAddress>
    addressesFromNetworkInterface(java.net.NetworkInterface intf)
     
    static java.net.InetAddress[]
    allAddressesByName(java.lang.String hostname)
     
    static void
    bind(java.net.Socket socket, java.net.SocketAddress bindpoint)
     
    static void
    bind(java.nio.channels.DatagramChannel networkChannel, java.net.SocketAddress address)
     
    static void
    bind(java.nio.channels.SocketChannel socketChannel, java.net.SocketAddress address)
     
    static void
    connect(java.net.Socket socket, java.net.SocketAddress remoteAddress, int timeout)
     
    static boolean
    connect(java.nio.channels.SocketChannel socketChannel, java.net.SocketAddress remoteAddress)
     
    private static <T> java.util.Enumeration<T>
     
    static byte[]
    hardwareAddressFromNetworkInterface(java.net.NetworkInterface intf)
     
    static java.net.SocketAddress
    localSocketAddress(java.net.ServerSocket socket)
     
    static java.net.InetAddress
     
    static java.net.InetSocketAddress
    socketAddress(java.lang.String hostname, int port)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • EMPTY

      private static final java.util.Enumeration<java.lang.Object> EMPTY
  • Constructor Details

    • SocketUtils

      private SocketUtils()
  • Method Details

    • empty

      private static <T> java.util.Enumeration<T> empty()
    • connect

      public static void connect(java.net.Socket socket, java.net.SocketAddress remoteAddress, int timeout) throws java.io.IOException
      Throws:
      java.io.IOException
    • bind

      public static void bind(java.net.Socket socket, java.net.SocketAddress bindpoint) throws java.io.IOException
      Throws:
      java.io.IOException
    • connect

      public static boolean connect(java.nio.channels.SocketChannel socketChannel, java.net.SocketAddress remoteAddress) throws java.io.IOException
      Throws:
      java.io.IOException
    • bind

      public static void bind(java.nio.channels.SocketChannel socketChannel, java.net.SocketAddress address) throws java.io.IOException
      Throws:
      java.io.IOException
    • accept

      public static java.nio.channels.SocketChannel accept(java.nio.channels.ServerSocketChannel serverSocketChannel) throws java.io.IOException
      Throws:
      java.io.IOException
    • bind

      public static void bind(java.nio.channels.DatagramChannel networkChannel, java.net.SocketAddress address) throws java.io.IOException
      Throws:
      java.io.IOException
    • localSocketAddress

      public static java.net.SocketAddress localSocketAddress(java.net.ServerSocket socket)
    • addressByName

      public static java.net.InetAddress addressByName(java.lang.String hostname) throws java.net.UnknownHostException
      Throws:
      java.net.UnknownHostException
    • allAddressesByName

      public static java.net.InetAddress[] allAddressesByName(java.lang.String hostname) throws java.net.UnknownHostException
      Throws:
      java.net.UnknownHostException
    • socketAddress

      public static java.net.InetSocketAddress socketAddress(java.lang.String hostname, int port)
    • addressesFromNetworkInterface

      public static java.util.Enumeration<java.net.InetAddress> addressesFromNetworkInterface(java.net.NetworkInterface intf)
    • loopbackAddress

      public static java.net.InetAddress loopbackAddress()
    • hardwareAddressFromNetworkInterface

      public static byte[] hardwareAddressFromNetworkInterface(java.net.NetworkInterface intf) throws java.net.SocketException
      Throws:
      java.net.SocketException