bind
Binds the channel's socket to a local address and configures the socket to listen for connections. This method is used to establish an association between the socket and a local address. OnceFor Internet protocol sockets, once an association is established then the socket remains bound until the channel is closed.
The backlog parameter is the maximum number of pending connections on the socket. Its exact semantics are implementation specific. In particular, an implementation may impose a maximum length or may choose to ignore the parameter altogther. If the backlog parameter has the value 0 , or a negative value, then an implementation specific default is used.
-
API Note:
-
Binding a server socket channel for a Unix Domain socket, creates a file corresponding to the file path in the
UnixDomainSocketAddress . This file persists after the channel is closed, and must be removed before another socket can bind to the same name. Binding to a null address causes the socket to be automatically bound to some unique file in a system temporary location. The associated socket file also persists after the channel is closed. Its name can be obtained from the channel's local socket address.
-
Implementation Note:
-
Each platform enforces an implementation specific, maximum length for the name of a Unix Domain socket. This limitation is enforced when a channel is bound. The maximum length is typically close to and generally not less than 100 bytes.
- Parameters:
-
local - The address to bind the socket, or null to bind to an automatically assigned socket address
-
backlog - The maximum number of pending connections
- Returns:
- This channel
- Throws:
-
AlreadyBoundException - If the socket is already bound
-
UnsupportedAddressTypeException - If the type of the given address is not supported
-
ClosedChannelException - If this channel is closed
-
IOException - If some other I/O error occurs
-
SecurityException - If a security manager has been installed and its checkListen method denies the operation for an Internet protocol socket address, or for a Unix domain socket address if it denies NetPermission ("accessUnixDomainSocket") .
- Since:
- 1.7
|
bind
Binds the channel's socket to a local address and configures the socket to listen for connections. This method is used to establish an association between the socket and a local address. Once an association is established then the socket remains bound until the channel is closed.
The backlog parameter is the maximum number of pending connections on the socket. Its exact semantics are implementation specific. In particular, an implementation may impose a maximum length or may choose to ignore the parameter altogther. If the backlog parameter has the value 0 , or a negative value, then an implementation specific default is used.
- Parameters:
-
local - The address to bind the socket, or null to bind to an automatically assigned socket address
-
backlog - The maximum number of pending connections
- Returns:
- This channel
- Throws:
-
AlreadyBoundException - If the socket is already bound
-
UnsupportedAddressTypeException - If the type of the given address is not supported
-
ClosedChannelException - If this channel is closed
-
IOException - If some other I/O error occurs
-
SecurityException - If a security manager has been installed and its checkListen method denies the operation
- Since:
- 1.7
|
bind
Binds the channel's socket to a local address and configures the socket to listen for connections. This method is used to establish an association between the socket and a local address. For Internet protocol sockets, once an association is established then the socket remains bound until the channel is closed.
The backlog parameter is the maximum number of pending connections on the socket. Its exact semantics are implementation specific. In particular, an implementation may impose a maximum length or may choose to ignore the parameter altogther. If the backlog parameter has the value 0 , or a negative value, then an implementation specific default is used.
- API Note:
- Binding a server socket channel for a Unix Domain socket, creates a file corresponding to the file path in the
UnixDomainSocketAddress . This file persists after the channel is closed, and must be removed before another socket can bind to the same name. Binding to a null address causes the socket to be automatically bound to some unique file in a system temporary location. The associated socket file also persists after the channel is closed. Its name can be obtained from the channel's local socket address.
- Implementation Note:
- Each platform enforces an implementation specific, maximum length for the name of a Unix Domain socket. This limitation is enforced when a channel is bound. The maximum length is typically close to and generally not less than 100 bytes.
- Parameters:
-
local - The address to bind the socket, or null to bind to an automatically assigned socket address
-
backlog - The maximum number of pending connections
- Returns:
- This channel
- Throws:
-
AlreadyBoundException - If the socket is already bound
-
UnsupportedAddressTypeException - If the type of the given address is not supported
-
ClosedChannelException - If this channel is closed
-
IOException - If some other I/O error occurs
-
SecurityException - If a security manager has been installed and its checkListen method denies the operation for an Internet protocol socket address, or for a Unix domain socket address if it denies NetPermission ("accessUnixDomainSocket") .
- Since:
- 1.7
|
|