Class UnixDomainSocketChannelExamples

java.lang.Object
net.jrodolfo.java_evolution.java16.unix_domain_socket.UnixDomainSocketChannelExamples

public class UnixDomainSocketChannelExamples extends Object
Demonstrates Unix-domain socket channel support, introduced in Java 16.
  • Constructor Details

    • UnixDomainSocketChannelExamples

      public UnixDomainSocketChannelExamples()
  • Method Details

    • protocolFamilyName

      public String protocolFamilyName()
      Names the protocol family used for Unix-domain socket channels.
      Returns:
      protocol family name
    • socketAddress

      public UnixDomainSocketAddress socketAddress(Path path)
      Creates a Unix-domain socket address from a local file-system path.
      Parameters:
      path - local socket path
      Returns:
      Unix-domain socket address
    • exchangeMessage

      public String exchangeMessage(Path socketPath, String message) throws IOException, InterruptedException
      Exchanges one short message through a Unix-domain socket.
      Parameters:
      socketPath - local socket path
      message - message sent by the client
      Returns:
      message received by the server
      Throws:
      IOException - when the socket cannot be opened, bound, connected, read, or written
      InterruptedException - when waiting for the client thread is interrupted