Class UnixDomainSocketChannelExamples
java.lang.Object
net.jrodolfo.java_evolution.java16.unix_domain_socket.UnixDomainSocketChannelExamples
Demonstrates Unix-domain socket channel support, introduced in Java 16.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexchangeMessage(Path socketPath, String message) Exchanges one short message through a Unix-domain socket.Names the protocol family used for Unix-domain socket channels.socketAddress(Path path) Creates a Unix-domain socket address from a local file-system path.
-
Constructor Details
-
UnixDomainSocketChannelExamples
public UnixDomainSocketChannelExamples()
-
-
Method Details
-
protocolFamilyName
Names the protocol family used for Unix-domain socket channels.- Returns:
- protocol family name
-
socketAddress
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 pathmessage- message sent by the client- Returns:
- message received by the server
- Throws:
IOException- when the socket cannot be opened, bound, connected, read, or writtenInterruptedException- when waiting for the client thread is interrupted
-