Package org.glassfish.grizzly
Interface SocketBinder
-
- All Known Implementing Classes:
AbstractBindingHandler
,NIOTransport
,TCPNIOBindingHandler
,TCPNIOTransport
,UDPNIOBindingHandler
,UDPNIOTransport
public interface SocketBinder
Common API forSocket
basedTransport
s, which are able to bind serverSocket
to specific address and listen for incoming data.- Author:
- Alexey Stashok
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Connection<?>
bind(int port)
Binds Transport to the specific port on localhost.Connection<?>
bind(String host, int port)
Binds Transport to the specific host and port.Connection<?>
bind(String host, int port, int backlog)
Binds Transport to the specific host and port.Connection<?>
bind(String host, PortRange portRange, boolean randomStartPort, int backlog)
Binds Transport to the specific host, and port within aPortRange
.Connection<?>
bind(String host, PortRange portRange, int backlog)
Binds Transport to the specific host, and port within aPortRange
.Connection<?>
bind(SocketAddress socketAddress)
Binds Transport to the specific SocketAddress.Connection<?>
bind(SocketAddress socketAddress, int backlog)
Binds Transport to the specific SocketAddress.Connection<?>
bindToInherited()
Binds the Transport to the channel inherited from the entity that created this Java virtual machine.void
unbind(Connection<?> connection)
Unbinds boundTransport
connection.void
unbindAll()
Unbinds all boundTransport
connections.
-
-
-
Method Detail
-
bind
Connection<?> bind(int port) throws IOException
Binds Transport to the specific port on localhost.- Parameters:
port
- the port to bind to- Returns:
- bound
Connection
- Throws:
IOException
- if unable to bind i.e. if port already bound
-
bind
Connection<?> bind(String host, int port) throws IOException
Binds Transport to the specific host and port.- Parameters:
host
- the local host the server will bind toport
- specific port to bind to- Returns:
- bound
Connection
- Throws:
IOException
- if unable to bind i.e. if port already bound
-
bind
Connection<?> bind(String host, int port, int backlog) throws IOException
Binds Transport to the specific host and port.- Parameters:
host
- the local host the server will bind toport
- the port to bind tobacklog
- the maximum length of the queue- Returns:
- bound
Connection
- Throws:
IOException
- if unable to bind i.e. if port already bound
-
bind
Connection<?> bind(String host, PortRange portRange, int backlog) throws IOException
Binds Transport to the specific host, and port within aPortRange
.- Parameters:
host
- the local host the server will bind toportRange
-PortRange
.backlog
- the maximum length of the queue- Returns:
- bound
Connection
- Throws:
IOException
- if unable to bind i.e. if port already bound
-
bind
Connection<?> bind(String host, PortRange portRange, boolean randomStartPort, int backlog) throws IOException
Binds Transport to the specific host, and port within aPortRange
.- Parameters:
host
- the local host the server will bind toportRange
-PortRange
.randomStartPort
- if true, a random port in the range will be used as the initial port.backlog
- the maximum length of the queue- Returns:
- bound
Connection
- Throws:
IOException
- if unable to bind i.e. if port already bound
-
bind
Connection<?> bind(SocketAddress socketAddress) throws IOException
Binds Transport to the specific SocketAddress.- Parameters:
socketAddress
- the local address the server will bind to- Returns:
- bound
Connection
- Throws:
IOException
- if unable to bind i.e. if port already bound
-
bind
Connection<?> bind(SocketAddress socketAddress, int backlog) throws IOException
Binds Transport to the specific SocketAddress.- Parameters:
socketAddress
- the local address the server will bind tobacklog
- the maximum length of the queue- Returns:
- bound
Connection
- Throws:
IOException
- if unable to bind i.e. if port already bound
-
bindToInherited
Connection<?> bindToInherited() throws IOException
Binds the Transport to the channel inherited from the entity that created this Java virtual machine.- Returns:
- bound
Connection
- Throws:
IOException
- if unable to bind i.e. if port already bound
-
unbind
void unbind(Connection<?> connection)
Unbinds boundTransport
connection.- Parameters:
connection
-Connection
-
unbindAll
void unbindAll()
Unbinds all boundTransport
connections.
-
-