public class BroadcastTransport extends Object implements Transport, ReactorHandler
BroadcastConnector registered
repeater and sends broadcasts datagrams to given addresses.| Modifier and Type | Field and Description |
|---|---|
protected ResponseHandler |
responseHandler
CAS reponse handler.
|
| Constructor and Description |
|---|
BroadcastTransport(CAContext context,
ResponseHandler responseHandler,
DatagramChannel channel,
InetSocketAddress connectAddress,
short remoteTransportRevision) |
| Modifier and Type | Method and Description |
|---|---|
void |
bind(boolean reuseAddress)
Bind UDP socket to the
connectAddress. |
void |
close()
Close transport.
|
boolean |
flush()
Enqueue (if necessary submit) request message.
|
InetSocketAddress[] |
getBroadcastAddresses()
Get list of broadcast addresses.
|
InetSocketAddress[] |
getBroadcastAddresses(int port) |
DatagramChannel |
getChannel() |
InetSocketAddress |
getConnectAddress()
Get connect address.
|
CAContext |
getContext()
Get context transport is living in.
|
InetSocketAddress[] |
getIgnoredAddresses()
Get list of ignored addresses.
|
short |
getMinorRevision()
Transport protocol minor revision.
|
short |
getPriority()
Transport priority.
|
InetSocketAddress |
getRemoteAddress()
Get remote address.
|
void |
handleEvent(SelectionKey key)
Handle IO event.
|
protected void |
processRead()
Process input (read) IO event.
|
protected void |
processWrite()
Process output (write) IO event.
|
protected void |
send(ByteBuffer buffer)
Send a buffer through the transport.
|
protected void |
send(ByteBuffer buffer,
InetSocketAddress address)
Send a buffer through the transport immediately.
|
void |
send(Request requestMessage,
InetSocketAddress address)
Send a request message through the transport.
|
void |
setBroadcastAddresses(InetSocketAddress[] addresses)
Set list of broadcast addresses.
|
void |
setIgnoredAddresses(InetSocketAddress[] addresses)
Set list of broadcast addresses.
|
void |
submit(Request requestMessage)
Send request message(s) immediately.
|
protected ResponseHandler responseHandler
public BroadcastTransport(CAContext context, ResponseHandler responseHandler, DatagramChannel channel, InetSocketAddress connectAddress, short remoteTransportRevision)
context - public InetSocketAddress[] getBroadcastAddresses(int port)
public void bind(boolean reuseAddress)
throws SocketException
connectAddress.reuseAddress - resuse address option.SocketExceptionpublic void close()
public void handleEvent(SelectionKey key)
handleEvent in interface ReactorHandlerkey - key to be processed.ReactorHandler.handleEvent(java.nio.channels.SelectionKey)protected void processRead()
protected void processWrite()
protected void send(ByteBuffer buffer)
buffer - buffer to send.protected void send(ByteBuffer buffer, InetSocketAddress address) throws IOException
buffer - buffer to send.address - send address.IOExceptionpublic short getMinorRevision()
TransportgetMinorRevision in interface TransportTransport.getMinorRevision()public void submit(Request requestMessage)
submit in interface TransportrequestMessage - request message to enqueue.Transport.submit(com.cosylab.epics.caj.impl.Request)public void send(Request requestMessage, InetSocketAddress address) throws IOException
requestMessage - message to send.address - send address.IOExceptionpublic CAContext getContext()
TransportgetContext in interface TransportTransport.getContext()public short getPriority()
TransportgetPriority in interface TransportTransport.getPriority()public boolean flush()
Transportflush in interface Transporttrue on success, false on failure.Transport.flush()public InetSocketAddress getRemoteAddress()
TransportgetRemoteAddress in interface TransportTransport.getRemoteAddress()public InetSocketAddress[] getBroadcastAddresses()
public InetSocketAddress[] getIgnoredAddresses()
public InetSocketAddress getConnectAddress()
public void setBroadcastAddresses(InetSocketAddress[] addresses)
DEFAULT_BROADCAST_ADDRESSES list.addresses - list of broadcast addresses, non-null.public void setIgnoredAddresses(InetSocketAddress[] addresses)
addresses - list of ignored addresses.public DatagramChannel getChannel()
Copyright © 2004-2020 EPICS. All Rights Reserved.