public class TcpDatagramSocket extends DatagramSocket
| Modifier and Type | Class and Description |
|---|---|
static class |
TcpDatagramSocket.Impl
A specialized version of
DatagramSocketImpl. |
| Modifier and Type | Field and Description |
|---|---|
static int |
IO_EXCEPTIONS_LOG_LEVEL
Debbuging flag for logging an IO exceptions which occur, set to a negative to disable the logging.
|
protected TcpDatagramSocket.Impl |
m_impl |
| Modifier | Constructor and Description |
|---|---|
|
TcpDatagramSocket()
Create a new TcpDatagramSocket that with a wildcard address bound to an ephemeral port.
|
|
TcpDatagramSocket(int nPort)
Creates a new TcpDatagramSocket using the wildcard address and the specified port.
|
|
TcpDatagramSocket(int nPort, InetAddress addr)
Creates a new TcpDatagramSocket using an
address and a port number. |
|
TcpDatagramSocket(SocketAddress addr)
Creates a new TcpDatagramSocket which will be bound to the specified
address. |
|
TcpDatagramSocket(com.oracle.common.net.SocketProvider provider)
Creates a new TcpDatagramSocket using the
provider. |
protected |
TcpDatagramSocket(TcpDatagramSocket.Impl impl)
Creates a new TcpDatagramSocket using an
TcpDatagramSocket.Impl. |
| Modifier and Type | Method and Description |
|---|---|
void |
bind(SocketAddress addr) |
boolean |
isBound() |
void |
receive(DatagramPacket p) |
void |
send(DatagramPacket p) |
void |
setAdvanceFrequency(int nAdvance)
Specify the frequency at which the DatagramSocket will advance over the sub-sockets during receive.
|
void |
setListenBacklog(int n)
Specify the listen backlog for the server socket.
|
void |
setPacketMagic(int nMagic, int nMask)
Specify the packet header which is included at the start of every packet.
|
void |
setSocketOptions(SocketOptions options)
Specify SocketOptions to be used to configure each of the underlying TCP sockets.
|
String |
toString() |
close, connect, connect, disconnect, getBroadcast, getChannel, getInetAddress, getLocalAddress, getLocalPort, getLocalSocketAddress, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoTimeout, getTrafficClass, isClosed, isConnected, setBroadcast, setDatagramSocketImplFactory, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoTimeout, setTrafficClasspublic static final int IO_EXCEPTIONS_LOG_LEVEL
protected TcpDatagramSocket.Impl m_impl
public TcpDatagramSocket()
throws SocketException
SocketException - if any error happens during the bind, or if the port is unavailablepublic TcpDatagramSocket(SocketAddress addr) throws SocketException
address.addr - the address to bindSocketException - if any error happens during the bind, or if the port is unavailable
public TcpDatagramSocket(int nPort)
throws SocketException
The port number should be between 0 and 65535. Zero means that the system will pick an ephemeral port during the bind operation.
nPort - the port to bind toSocketException - if any error happens during the bind, or if the port is unavailable
public TcpDatagramSocket(int nPort,
InetAddress addr)
throws SocketException
address and a port number.
If null is specified as the address assigned will be the wildcard address.
The port number should be between 0 and 65535. Zero means that the system will pick an ephemeral port during the bind operation.
nPort - the port numberaddr - the IP addressSocketException - if any error happens during the bind, or if the port is unavailable
public TcpDatagramSocket(com.oracle.common.net.SocketProvider provider)
throws SocketException
provider.provider - the provider to be usedSocketException - if any error happens during the bind, or if the port is unavailableprotected TcpDatagramSocket(TcpDatagramSocket.Impl impl)
TcpDatagramSocket.Impl.impl - a TcpDatagramSocket.Implpublic void setSocketOptions(SocketOptions options) throws SocketException
options - the SocketOptionsSocketException - if the options fail to be set
public void setListenBacklog(int n)
throws IOException
n - the depth of the backlog, or <=0 for the OS default.IOException - if the port is unavailable
public void setPacketMagic(int nMagic,
int nMask)
throws IOException
nMagic - the packet headernMask - the packet header bitmask identifying the bits usedIOException - if the port is unavailablepublic void setAdvanceFrequency(int nAdvance)
nAdvance - the packet frequency at which to advance between peerspublic void bind(SocketAddress addr) throws SocketException
bind in class DatagramSocketSocketExceptionpublic boolean isBound()
isBound in class DatagramSocketpublic void send(DatagramPacket p) throws IOException
send in class DatagramSocketIOExceptionpublic void receive(DatagramPacket p) throws IOException
receive in class DatagramSocketIOException