feat: Returns the known socket address for sockets from the single-port mode.
This commit is contained in:
parent
15a2df1e59
commit
c378329b8c
@ -391,7 +391,7 @@ public abstract class AbstractUdpListener
|
||||
/**
|
||||
* The remote address that is associated with this socket.
|
||||
*/
|
||||
private SocketAddress remoteAddress;
|
||||
private InetSocketAddress remoteAddress;
|
||||
|
||||
/**
|
||||
* The flag which indicates that this <tt>DatagramSocket</tt> has been
|
||||
@ -406,7 +406,7 @@ public abstract class AbstractUdpListener
|
||||
* new instance.
|
||||
* @throws SocketException
|
||||
*/
|
||||
public MySocket(SocketAddress remoteAddress)
|
||||
MySocket(InetSocketAddress remoteAddress)
|
||||
throws SocketException
|
||||
{
|
||||
// unbound
|
||||
@ -487,6 +487,45 @@ public abstract class AbstractUdpListener
|
||||
return localAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* </p>
|
||||
* This {@link DatagramSocket} will only allow packets from the
|
||||
* remote address that it has, so we consider it connected to this
|
||||
* address.
|
||||
*/
|
||||
@Override
|
||||
public SocketAddress getRemoteSocketAddress()
|
||||
{
|
||||
return remoteAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* </p>
|
||||
* This {@link DatagramSocket} will only allow packets from the
|
||||
* remote address that it has, so we consider it connected to this
|
||||
* address.
|
||||
*/
|
||||
@Override
|
||||
public InetAddress getInetAddress()
|
||||
{
|
||||
return remoteAddress.getAddress();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* </p>
|
||||
* This {@link DatagramSocket} will only allow packets from the
|
||||
* remote address that it has, so we consider it connected to this
|
||||
* address.
|
||||
*/
|
||||
@Override
|
||||
public int getPort()
|
||||
{
|
||||
return remoteAddress.getPort();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user