Package io.dapr.utils

# Class NetworkUtils

java.lang.Object
io.dapr.utils.NetworkUtils

public final class NetworkUtils extends Object
Utility methods for network, internal to Dapr SDK.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static io.grpc.ManagedChannel`
  `buildGrpcManagedChannel(Properties properties, io.grpc.ClientInterceptor... interceptors)`
  Creates a GRPC managed channel.
  `static String`
  `getHostLoopbackAddress()`
  Retrieve loopback address for the host.
  `static void`
  `waitForSocket(String host, int port, int timeoutInMilliseconds)`
  Tries to connect to a socket, retrying every 1 second.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### waitForSocket

    public static void waitForSocket(String host, int port, int timeoutInMilliseconds) throws InterruptedException
    Tries to connect to a socket, retrying every 1 second.
    Parameters:
      `host` - Host to connect to.
      `port` - Port to connect to.
      `timeoutInMilliseconds` - Timeout in milliseconds to give up trying.
    Throws:
      `InterruptedException` - If retry is interrupted.

  - ### buildGrpcManagedChannel

    public static io.grpc.ManagedChannel buildGrpcManagedChannel(Properties properties, io.grpc.ClientInterceptor... interceptors)
    Creates a GRPC managed channel.
    Parameters:
      `properties` - instance to set up the GrpcEndpoint
      `interceptors` - Optional interceptors to add to the channel.
    Returns:
      GRPC managed channel to communicate with the sidecar.

  - ### getHostLoopbackAddress

    public static String getHostLoopbackAddress()
    Retrieve loopback address for the host.
    Returns:
      The loopback address String