public class ReliableServerSocket
extends java.net.ServerSocket
ServerSocket
Constructor and Description |
---|
ReliableServerSocket()
Creates an unbound RUDP server socket.
|
ReliableServerSocket(java.net.DatagramSocket sock,
int backlog)
Creates a RUDP server socket attached to the specified UDP socket, with
the specified backlog.
|
ReliableServerSocket(int port)
Creates a RUDP server socket, bound to the specified port.
|
ReliableServerSocket(int port,
int backlog)
Creates a RUDP server socket and binds it to the specified local port,
with the specified backlog.
|
ReliableServerSocket(int port,
int backlog,
java.net.InetAddress bindAddr)
Creates a RUDP server socket and binds it to the specified local port and
IP address, with the specified backlog.
|
Modifier and Type | Method and Description |
---|---|
java.net.Socket |
accept() |
void |
bind(java.net.SocketAddress endpoint) |
void |
bind(java.net.SocketAddress endpoint,
int backlog) |
void |
close() |
java.net.InetAddress |
getInetAddress() |
int |
getLocalPort() |
java.net.SocketAddress |
getLocalSocketAddress() |
int |
getSoTimeout() |
boolean |
isBound() |
boolean |
isClosed() |
void |
setSoTimeout(int timeout) |
public ReliableServerSocket() throws java.io.IOException
java.io.IOException
- if an I/O error occurs when opening the underlying UDP
socket.ServerSocket.ServerSocket()
public ReliableServerSocket(int port) throws java.io.IOException
0
creates a socket on any free port. The maximum queue
length for incoming connection indications (a request to connect) is set
to 50
. If a connection indication arrives when the queue is
full, the connection is refused.port
- the port number, or 0
to use any free port.java.io.IOException
- if an I/O error occurs when opening the underlying UDP
socket.ServerSocket.ServerSocket(int)
public ReliableServerSocket(int port, int backlog) throws java.io.IOException
0
creates a socket on
any free port.port
- the port number, or 0
to use any free port.backlog
- the listen backlog.java.io.IOException
- if an I/O error occurs when opening the underlying UDP
socket.ServerSocket.ServerSocket(int, int)
public ReliableServerSocket(int port, int backlog, java.net.InetAddress bindAddr) throws java.io.IOException
0
creates a socket on any free port.port
- the port number, or 0
to use any free port.backlog
- the listen backlog.bindAddr
- the local InetAddress the server will bind to.java.io.IOException
- if an I/O error occurs when opening the underlying UDP
socket.ServerSocket.ServerSocket(int, int, InetAddress)
public ReliableServerSocket(java.net.DatagramSocket sock, int backlog) throws java.io.IOException
sock
- the underlying UDP socket.backlog
- the listen backlog.java.io.IOException
- if an I/O error occurs.public java.net.Socket accept() throws java.io.IOException
accept
in class java.net.ServerSocket
java.io.IOException
public void bind(java.net.SocketAddress endpoint) throws java.io.IOException
bind
in class java.net.ServerSocket
java.io.IOException
public void bind(java.net.SocketAddress endpoint, int backlog) throws java.io.IOException
bind
in class java.net.ServerSocket
java.io.IOException
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.net.ServerSocket
public java.net.InetAddress getInetAddress()
getInetAddress
in class java.net.ServerSocket
public int getLocalPort()
getLocalPort
in class java.net.ServerSocket
public java.net.SocketAddress getLocalSocketAddress()
getLocalSocketAddress
in class java.net.ServerSocket
public boolean isBound()
isBound
in class java.net.ServerSocket
public boolean isClosed()
isClosed
in class java.net.ServerSocket
public void setSoTimeout(int timeout)
setSoTimeout
in class java.net.ServerSocket
public int getSoTimeout()
getSoTimeout
in class java.net.ServerSocket