Class PdRequester

java.lang.Object
com.trdp.pd.PdRequester
All Implemented Interfaces:
AutoCloseable

public class PdRequester extends Object implements 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
    Constructor
    Description
    PdRequester(int localPort)
    Creates a PD Requester.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    request(int comId, String destinationIp, int destinationPort, int replyComId, String replyIpAddress)
    Sends a PD Request to a Publisher with no payload.
    void
    request(int comId, String destinationIp, int destinationPort, int replyComId, String replyIpAddress, byte[] payload)
    Sends a PD Request to a Publisher with an optional payload.
    void
    setTopologyCounters(int etbTopoCnt, int opTrnTopoCnt)
    Sets the topology counters to be sent with the request.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PdRequester

      public PdRequester(int localPort) throws IOException
      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 counter
      opTrnTopoCnt - 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:
      close in interface AutoCloseable