public class IceUdpSocketWrapper extends IceSocketWrapper
Modifier and Type | Field and Description |
---|---|
private DatagramSocket |
socket
Delegate UDP DatagramSocket.
|
Constructor and Description |
---|
IceUdpSocketWrapper(DatagramSocket delegate)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this socket.
|
InetAddress |
getLocalAddress()
Get local address.
|
int |
getLocalPort()
Get local port.
|
SocketAddress |
getLocalSocketAddress()
Get socket address.
|
Socket |
getTCPSocket()
Returns Socket object if the delegate socket is a TCP one, null
otherwise.
|
DatagramSocket |
getUDPSocket()
Returns DatagramSocket object if the delegate socket is a UDP one, null
otherwise.
|
void |
receive(DatagramPacket p)
Receives a DatagramPacket from this socket.
|
void |
send(DatagramPacket p)
Sends a DatagramPacket from this socket
It is a utility method to provide a common way to send for both
UDP and TCP socket.
|
private final DatagramSocket socket
public IceUdpSocketWrapper(DatagramSocket delegate)
delegate
- delegate DatagramSocketpublic void send(DatagramPacket p) throws IOException
send
in class IceSocketWrapper
p
- DatagramPacket to sendIOException
- if something goes wrongpublic void receive(DatagramPacket p) throws IOException
receive
in class IceSocketWrapper
p
- DatagramPacketIOException
- if something goes wrongpublic void close()
close
in class IceSocketWrapper
public InetAddress getLocalAddress()
getLocalAddress
in class IceSocketWrapper
public int getLocalPort()
getLocalPort
in class IceSocketWrapper
public SocketAddress getLocalSocketAddress()
getLocalSocketAddress
in class IceSocketWrapper
public Socket getTCPSocket()
getTCPSocket
in class IceSocketWrapper
public DatagramSocket getUDPSocket()
getUDPSocket
in class IceSocketWrapper
Copyright © 2018. All rights reserved.