Class PdRequester
java.lang.Object
com.trdp.pd.PdRequester
- All Implemented Interfaces:
AutoCloseable
Implements the Requester role for the TRDP Process Data (PD) Pull Pattern.
The Requester sends PD-PDU request telegrams to a Publisher to solicit a PD-PDU reply.
The reply is typically received by a TrdpPdSession subscriber.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidrequest(int comId, String destinationIp, int destinationPort, int replyComId, String replyIpAddress) Sends a PD Request to a Publisher with no payload.voidrequest(int comId, String destinationIp, int destinationPort, int replyComId, String replyIpAddress, byte[] payload) Sends a PD Request to a Publisher with an optional payload.voidsetTopologyCounters(int etbTopoCnt, int opTrnTopoCnt) Sets the topology counters to be sent with the request.
-
Constructor Details
-
PdRequester
Creates a PD Requester.- Parameters:
localPort- The local port to bind to. Use 0 for an ephemeral port.- Throws:
IOException
-
-
Method Details
-
setTopologyCounters
public void setTopologyCounters(int etbTopoCnt, int opTrnTopoCnt) Sets the topology counters to be sent with the request.- Parameters:
etbTopoCnt- The ETB topology counteropTrnTopoCnt- The Operational Train topology counter
-
request
public void request(int comId, String destinationIp, int destinationPort, int replyComId, String replyIpAddress) throws IOException Sends a PD Request to a Publisher with no payload.- Parameters:
comId- The ComID of the process data being requested.destinationIp- The IP address of the Publisher.destinationPort- The port of the Publisher.replyComId- The ComID to be used in the reply (0 to use the requested ComID).replyIpAddress- The IP address where the reply should be sent (e.g. multicast group or unicast IP). If null or 0.0.0.0, the source IP of the request will be used by the Publisher.- Throws:
IOException- If sending fails.
-
request
public void request(int comId, String destinationIp, int destinationPort, int replyComId, String replyIpAddress, byte[] payload) throws IOException Sends a PD Request to a Publisher with an optional payload.- Parameters:
comId- The ComID of the process data being requested.destinationIp- The IP address of the Publisher.destinationPort- The port of the Publisher.replyComId- The ComID to be used in the reply (0 to use the requested ComID).replyIpAddress- The IP address where the reply should be sent (e.g. multicast group or unicast IP). If null or 0.0.0.0, the source IP of the request will be used by the Publisher.payload- Optional payload data to include in the request, or null for empty payload.- Throws:
IOException- If sending fails.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-