Added a String getAddress() to the server-side connection
stuff... this will be useful for certain types of filtering and is good for informational logging. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7030 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
c21ae83fc1
commit
fd62579bf3
@ -48,6 +48,14 @@ public interface HostedConnection extends MessageConnection
|
||||
*/
|
||||
public int getId();
|
||||
|
||||
/**
|
||||
* Returns the transport specific remote address of this connection
|
||||
* as a string. This may or may not be unique per connection depending
|
||||
* on the type of transport. It is provided for information and filtering
|
||||
* purposes.
|
||||
*/
|
||||
public String getAddress();
|
||||
|
||||
/**
|
||||
* Closes and removes this connection from the server
|
||||
* sending the optional reason to the remote client.
|
||||
|
@ -353,6 +353,11 @@ public class DefaultServer implements Server
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getAddress()
|
||||
{
|
||||
return reliable == null ? null : reliable.getAddress();
|
||||
}
|
||||
|
||||
public void send( Message message )
|
||||
{
|
||||
ByteBuffer buffer = MessageProtocol.messageToBuffer(message, null);
|
||||
|
@ -49,6 +49,13 @@ public interface Endpoint
|
||||
*/
|
||||
public long getId();
|
||||
|
||||
/**
|
||||
* Returns the transport specific remote address of this endpoint
|
||||
* as a string. This may or may not be unique per endpoint depending
|
||||
* on the type of transport.
|
||||
*/
|
||||
public String getAddress();
|
||||
|
||||
/**
|
||||
* Returns the kernel to which this endpoint belongs.
|
||||
*/
|
||||
|
@ -81,6 +81,11 @@ public class NioEndpoint implements Endpoint
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getAddress()
|
||||
{
|
||||
return String.valueOf(socket.socket().getRemoteSocketAddress());
|
||||
}
|
||||
|
||||
public boolean isConnected()
|
||||
{
|
||||
return socket.isConnected();
|
||||
|
@ -86,6 +86,11 @@ public class UdpEndpoint implements Endpoint
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getAddress()
|
||||
{
|
||||
return String.valueOf(address);
|
||||
}
|
||||
|
||||
public boolean isConnected()
|
||||
{
|
||||
return socket.isConnected();
|
||||
|
Loading…
x
Reference in New Issue
Block a user