net.named_data.jndn.transport
public class UdpTransport extends Transport
Modifier and Type | Class and Description |
---|---|
static class |
UdpTransport.ConnectionInfo
A UdpTransport.ConnectionInfo extends Transport.ConnectionInfo to hold
the host and port info for the UDP connection.
|
Constructor and Description |
---|
UdpTransport() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the connection.
|
void |
connect(Transport.ConnectionInfo connectionInfo,
ElementListener elementListener,
Runnable onConnected)
Connect according to the info in ConnectionInfo, and use elementListener.
|
boolean |
getIsConnected()
Check if the transport is connected.
|
boolean |
isAsync()
Override to return false since connect does not need to use the onConnected
callback.
|
boolean |
isLocal(Transport.ConnectionInfo connectionInfo)
Determine whether this transport connecting according to connectionInfo is
to a node on the current machine.
|
void |
processEvents()
Process any data to receive.
|
void |
send(ByteBuffer data)
Send data to the host
|
public boolean isLocal(Transport.ConnectionInfo connectionInfo)
public boolean isAsync()
public void connect(Transport.ConnectionInfo connectionInfo, ElementListener elementListener, Runnable onConnected) throws IOException
connect
in class Transport
connectionInfo
- A UdpTransport.ConnectionInfo.elementListener
- The ElementListener must remain valid during the
life of this object.onConnected
- If not null, this calls onConnected.run() when the
connection is established.IOException
- For I/O error.public void send(ByteBuffer data) throws IOException
send
in class Transport
data
- The buffer of data to send. This reads from position() to
limit(), but does not change the position.IOException
- For I/O error.public void processEvents() throws IOException, EncodingException
processEvents
in class Transport
IOException
- For I/O error.EncodingException
- For invalid encoding.public boolean getIsConnected() throws IOException
getIsConnected
in class Transport
IOException
public void close() throws IOException
close
in class Transport
IOException
- For I/O error.Copyright © 2016. All rights reserved.