Package org.jgroups.util
Interface SocketFactory
- All Known Implementing Classes:
DefaultSocketFactory
public interface SocketFactory
Factory to create various types of sockets. For socket creation, a service name can be passed as argument:
an implementation could look up a service description (e.g. port) and create the socket, ignoring the passed port and
possibly also the bind address.
Ephemeral ports can be created by passing 0 as port, or (if the port is ignored), an implementation could pass in a special service name (e.g. "EPHEMERAL"), this is implementation dependent.
The socket creation methods have the same parameter lists as the socket constructors, e.g.
createServerSocket(String, int, int) is the same as ServerSocket(int, int).
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose(DatagramSocket sock) voidclose(ServerSocket sock) voiddefault voidclose(ServerSocketChannel channel) default voidclose(SocketChannel channel) createDatagramSocket(String service_name) createDatagramSocket(String service_name, int port) createDatagramSocket(String service_name, int port, InetAddress laddr) createDatagramSocket(String service_name, SocketAddress bindaddr) createMulticastSocket(String service_name) createMulticastSocket(String service_name, int port) createMulticastSocket(String service_name, SocketAddress bindaddr) createServerSocket(String service_name) createServerSocket(String service_name, int port) createServerSocket(String service_name, int port, int backlog) createServerSocket(String service_name, int port, int backlog, InetAddress bindAddr) default ServerSocketChannelcreateServerSocketChannel(String service_name) default ServerSocketChannelcreateServerSocketChannel(String service_name, int port) default ServerSocketChannelcreateServerSocketChannel(String service_name, int port, int backlog) default ServerSocketChannelcreateServerSocketChannel(String service_name, int port, int backlog, InetAddress bindAddr) createSocket(String service_name) createSocket(String service_name, String host, int port) createSocket(String service_name, String host, int port, InetAddress localAddr, int localPort) createSocket(String service_name, InetAddress address, int port) createSocket(String service_name, InetAddress address, int port, InetAddress localAddr, int localPort) default SocketChannelcreateSocketChannel(String service_name) default SocketChannelcreateSocketChannel(String service_name, SocketAddress bindAddr)
-
Method Details
-
createSocket
- Throws:
IOException
-
createSocket
- Throws:
IOException
-
createSocket
- Throws:
IOException
-
createSocket
Socket createSocket(String service_name, String host, int port, InetAddress localAddr, int localPort) throws IOException - Throws:
IOException
-
createSocket
Socket createSocket(String service_name, InetAddress address, int port, InetAddress localAddr, int localPort) throws IOException - Throws:
IOException
-
createServerSocket
- Throws:
IOException
-
createServerSocket
- Throws:
IOException
-
createServerSocket
- Throws:
IOException
-
createServerSocket
ServerSocket createServerSocket(String service_name, int port, int backlog, InetAddress bindAddr) throws IOException - Throws:
IOException
-
createSocketChannel
- Throws:
IOException
-
createSocketChannel
default SocketChannel createSocketChannel(String service_name, SocketAddress bindAddr) throws IOException - Throws:
IOException
-
createServerSocketChannel
- Throws:
IOException
-
createServerSocketChannel
default ServerSocketChannel createServerSocketChannel(String service_name, int port) throws IOException - Throws:
IOException
-
createServerSocketChannel
default ServerSocketChannel createServerSocketChannel(String service_name, int port, int backlog) throws IOException - Throws:
IOException
-
createServerSocketChannel
default ServerSocketChannel createServerSocketChannel(String service_name, int port, int backlog, InetAddress bindAddr) throws IOException - Throws:
IOException
-
createDatagramSocket
- Throws:
SocketException
-
createDatagramSocket
DatagramSocket createDatagramSocket(String service_name, SocketAddress bindaddr) throws SocketException - Throws:
SocketException
-
createDatagramSocket
- Throws:
SocketException
-
createDatagramSocket
DatagramSocket createDatagramSocket(String service_name, int port, InetAddress laddr) throws SocketException - Throws:
SocketException
-
createMulticastSocket
- Throws:
IOException
-
createMulticastSocket
- Throws:
IOException
-
createMulticastSocket
MulticastSocket createMulticastSocket(String service_name, SocketAddress bindaddr) throws IOException - Throws:
IOException
-
close
- Throws:
IOException
-
close
- Throws:
IOException
-
close
-
close
-
close
-