public class ScionDatagramSocket extends DatagramSocket
Note: use of this class is discouraged in favor of org.scion.ScionDatagramChannel. The
reason is that this class' API (InetAddress and DatagramPacket) cannot be extended to support
SCION paths. As a consequence, a server needs to cache paths internally which requires memory and
may cause exceptions if more connections (=paths) are managed than the configured thresholds
allows.
| Modifier | Constructor and Description |
|---|---|
|
ScionDatagramSocket() |
|
ScionDatagramSocket(int port) |
|
ScionDatagramSocket(int port,
InetAddress bindAddress) |
protected |
ScionDatagramSocket(ScionService service,
DatagramChannel channel) |
|
ScionDatagramSocket(SocketAddress bindAddress) |
protected |
ScionDatagramSocket(SocketAddress bindAddress,
ScionService service) |
| Modifier and Type | Method and Description |
|---|---|
void |
bind(SocketAddress address) |
void |
close() |
void |
connect(InetAddress address,
int port) |
void |
connect(Path path)
Connect to a destination using a specific path.
|
void |
connect(SocketAddress address) |
static ScionDatagramSocket |
create(ScionService service)
Creates a ScionDatagramSocket with a specific ScionService instance.
|
static ScionDatagramSocket |
create(ScionService service,
DatagramChannel channel) |
static ScionDatagramSocket |
create(SocketAddress bindAddress,
ScionService service) |
void |
disconnect() |
boolean |
getBroadcast() |
Path |
getCachedPath(InetSocketAddress address)
The DatagramSocket caches paths from received packets.
|
DatagramChannel |
getChannel() |
Path |
getConnectionPath()
Get the currently connected path.
|
InetAddress |
getInetAddress() |
InetAddress |
getLocalAddress() |
int |
getLocalPort() |
SocketAddress |
getLocalSocketAddress() |
<T> T |
getOption(SocketOption<T> name) |
int |
getPathCacheCapacity()
The DatagramSocket caches paths from received packets.
|
PathPolicy |
getPathPolicy() |
int |
getPort() |
int |
getReceiveBufferSize() |
SocketAddress |
getRemoteSocketAddress() |
boolean |
getReuseAddress() |
ScionDatagramChannel |
getScionChannel()
Deprecated.
This method will be removed in a future version once
getChannel() is
implemented. |
int |
getSendBufferSize() |
ScionService |
getService() |
int |
getSoTimeout() |
int |
getTrafficClass() |
boolean |
isBound() |
boolean |
isClosed() |
boolean |
isConnected() |
void |
joinGroup(SocketAddress mcastaddr,
NetworkInterface netIf)
This method is currently not supported in SCION.
|
void |
leaveGroup(SocketAddress mcastaddr,
NetworkInterface netIf)
This method is currently not supported in SCION.
|
void |
receive(DatagramPacket packet) |
void |
send(DatagramPacket packet) |
void |
setBroadcast(boolean flag) |
static void |
setDatagramSocketImplFactory(DatagramSocketImplFactory factory) |
<T> ScionDatagramSocket |
setOption(SocketOption<T> name,
T value) |
void |
setOverrideSourceAddress(InetSocketAddress overrideSourceAddress)
Specify an source address override.
|
void |
setPathCacheCapacity(int capacity)
The DatagramSocket caches paths from received packets.
|
void |
setPathPolicy(PathPolicy pathPolicy)
Set the path policy.
|
void |
setReceiveBufferSize(int size) |
ScionDatagramSocket |
setRemoteDispatcher(boolean hasDispatcher)
Deprecated.
Not required anymore, will be removed for 0.5.0
|
void |
setReuseAddress(boolean flag) |
void |
setSendBufferSize(int size) |
void |
setSoTimeout(int timeOut) |
void |
setTrafficClass(int trafficClass) |
Set<SocketOption<?>> |
supportedOptions() |
public ScionDatagramSocket()
throws SocketException
SocketExceptionpublic ScionDatagramSocket(int port)
throws SocketException
SocketExceptionpublic ScionDatagramSocket(int port,
InetAddress bindAddress)
throws SocketException
SocketExceptionpublic ScionDatagramSocket(SocketAddress bindAddress) throws SocketException
SocketExceptionprotected ScionDatagramSocket(ScionService service, DatagramChannel channel) throws SocketException
SocketExceptionprotected ScionDatagramSocket(SocketAddress bindAddress, ScionService service) throws SocketException
SocketExceptionpublic static ScionDatagramSocket create(ScionService service) throws SocketException
ScionDatagramChannel.open(ScionService).service - A ScionService or 'null'.SocketExceptionpublic static ScionDatagramSocket create(ScionService service, DatagramChannel channel) throws SocketException
SocketExceptionpublic static ScionDatagramSocket create(SocketAddress bindAddress, ScionService service) throws SocketException
SocketExceptionpublic static void setDatagramSocketImplFactory(DatagramSocketImplFactory factory) throws IOException
IOExceptionpublic void bind(SocketAddress address) throws SocketException
bind in class DatagramSocketSocketExceptionpublic void connect(Path path)
AbstractDatagramChannel.connect(Path)
for details.path - path to destinationAbstractDatagramChannel.connect(Path)public void connect(InetAddress address, int port)
connect in class DatagramSocketpublic void connect(SocketAddress address) throws SocketException
connect in class DatagramSocketSocketExceptionpublic void disconnect()
disconnect in class DatagramSocketpublic boolean isBound()
isBound in class DatagramSocketpublic boolean isConnected()
isConnected in class DatagramSocketpublic void close()
close in interface Closeableclose in interface AutoCloseableclose in class DatagramSocketpublic boolean isClosed()
isClosed in class DatagramSocketpublic InetAddress getInetAddress()
getInetAddress in class DatagramSocketpublic int getPort()
getPort in class DatagramSocketpublic SocketAddress getRemoteSocketAddress()
getRemoteSocketAddress in class DatagramSocketpublic SocketAddress getLocalSocketAddress()
getLocalSocketAddress in class DatagramSocketpublic void send(DatagramPacket packet) throws IOException
send in class DatagramSocketIOExceptionpublic void receive(DatagramPacket packet) throws IOException
receive in class DatagramSocketIOExceptionpublic InetAddress getLocalAddress()
getLocalAddress in class DatagramSocketpublic int getLocalPort()
getLocalPort in class DatagramSocketpublic boolean getBroadcast()
throws SocketException
getBroadcast in class DatagramSocketSocketExceptionpublic void setBroadcast(boolean flag)
throws SocketException
setBroadcast in class DatagramSocketSocketExceptionpublic boolean getReuseAddress()
throws SocketException
getReuseAddress in class DatagramSocketSocketExceptionpublic void setReuseAddress(boolean flag)
throws SocketException
setReuseAddress in class DatagramSocketSocketExceptionpublic int getReceiveBufferSize()
throws SocketException
getReceiveBufferSize in class DatagramSocketSocketExceptionpublic void setReceiveBufferSize(int size)
throws SocketException
setReceiveBufferSize in class DatagramSocketSocketExceptionpublic int getSendBufferSize()
throws SocketException
getSendBufferSize in class DatagramSocketSocketExceptionpublic void setSendBufferSize(int size)
throws SocketException
setSendBufferSize in class DatagramSocketSocketExceptionpublic int getSoTimeout()
throws SocketException
getSoTimeout in class DatagramSocketSocketExceptionpublic void setSoTimeout(int timeOut)
throws SocketException
setSoTimeout in class DatagramSocketSocketExceptionpublic int getTrafficClass()
throws SocketException
getTrafficClass in class DatagramSocketSocketExceptionpublic void setTrafficClass(int trafficClass)
throws SocketException
setTrafficClass in class DatagramSocketSocketExceptionpublic DatagramChannel getChannel()
getChannel in class DatagramSocketpublic <T> ScionDatagramSocket setOption(SocketOption<T> name, T value) throws IOException
IOExceptionpublic <T> T getOption(SocketOption<T> name) throws IOException
IOExceptionpublic Set<SocketOption<?>> supportedOptions()
public void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
mcastaddr - multicast addressnetIf - network interfaceIOException - in case of IO errorpublic void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
mcastaddr - multicast addressnetIf - network interfaceIOException - in case of IO errorpublic Path getConnectionPath()
connect(Path) and
may be refreshed when expired.AbstractDatagramChannel.getConnectionPath()public Path getCachedPath(InetSocketAddress address)
setPathCacheCapacity(int).setPathCacheCapacity(int)public void setPathCacheCapacity(int capacity)
public int getPathCacheCapacity()
setPathCacheCapacity(int)@Deprecated public ScionDatagramChannel getScionChannel()
getChannel() is
implemented.public ScionService getService()
AbstractDatagramChannel.getService()public PathPolicy getPathPolicy()
public void setPathPolicy(PathPolicy pathPolicy) throws IOException
PathPolicy.DEFAULT. If the
socket is connected, this method will request a new path using the new policy.
After initially setting the path policy, it is used to request a new path during write() and send() whenever a path turns out to be close to expiration.
pathPolicy - the new path policyIOExceptionPathPolicy.DEFAULT,
AbstractDatagramChannel.setPathPolicy(PathPolicy)@Deprecated public ScionDatagramSocket setRemoteDispatcher(boolean hasDispatcher)
See AbstractDatagramChannel.configureRemoteDispatcher(boolean).
hasDispatcher - Set to 'true' if remote end-host uses a dispatcher and requires using port
30041.AbstractDatagramChannel.configureRemoteDispatcher(boolean)public void setOverrideSourceAddress(InetSocketAddress overrideSourceAddress)
AbstractDatagramChannel.setOverrideSourceAddress(InetSocketAddress).overrideSourceAddress - Override addressCopyright © 2024. All rights reserved.