Important: The information in this document is obsolete and should not be used for new development.
Measuring Packet-Delivery Performance
You use the AppleTalk Echo Protocol (AEP) to measure the performance of an AppleTalk network. Knowing the approximate speed at which an AppleTalk internet delivers packets is helpful in tuning the behavior of an application that uses one of the higher-level AppleTalk protocols, such as ATP and ADSP. You can also use AEP to test whether a node is on the network.To tune an application, you need to know the round-trip time of a packet between two nodes on an AppleTalk internet. This is dependent on such factors as the network configuration, the number of routers and bridges that a packet must traverse, and the amount of traffic on the network; as these change, so does the packet transmission time. Routines belonging to the interfaces of both ATP and ADSP let you specify retry count and interval numbers whose optimum values you can better assess if you know the average round-trip time of a packet on your application's network.
AEP is implemented in each node as a DDP client process referred to as the AEP Echoer. The AEP Echoer uses a statically assigned socket, socket number 4, known as the echoer socket. The AEP Echoer listens for packets received through this socket.
Whenever it receives a packet, the AEP Echoer examines the packet's protocol type field to determine if the packet is an AEP packet, indicated by a value of 4. If it is, the first byte of the data portion of the packet serves as a function field. AEP uses two function codes:
The AEP Echoer sets this field to a value of 2 to indicate that the packet is now a reply packet, then it calls DDP to send a copy of the packet back to the socket from which it originated. The AEP packet that you send is referred to as an Echo Request packet; the modified AEP packet that the AEP Echoer sends back to you is referred to as an Echo Reply packet.
- A value of 1 identifies the packet as an Echo Request packet.
- A value of 2 identifies the packet as an Echo Reply packet.
Here are some general guidelines that you should follow in using the AEP Echoer:
Follow these steps to send a packet to a target node and have AEP echo that packet back to your socket listener:
- Use the maximum packet size that you plan on using in your application.
- To test if a node is on the network, send several packets to that node because DDP can sometimes drop a packet.
- To test packet-delivery performance, send more than one packet and calculate the average round-trip time.
Typically, you should receive an Echo Reply packet within a few milliseconds. If you do not get a response after about 10 seconds, you can assume that DDP dropped or lost your Echo Request packet, and you should resend the packet.
The Echo Reply packet contains the same data that you sent in the Echo Request packet. If you send multiple packets to determine an average turnaround time and
to compensate for the possibility of lost or dropped packets, you should include different data in the data portion of each packet; this will allow you to distinguish between replies to different request packets in the event that some replies are not delivered in the same order that you sent them or that some packets are dropped.- To test packet-delivery performance time, your socket listener can include a field in its packet buffer record that saves the time in ticks when you sent the packet to compare against the response time.
- Accept only packets from the target node. Use your socket listener to filter out packets from nodes other than the target node to which you sent the Echo Request packet.
- Write a socket listener to be used to receive an Echo Reply packet back from the target node to which you are sending the Echo Request packet.
The AEP Echoer will send the Echo Reply packet to the socket from which you send the Echo Request packet. Follow the general instructions described earlier in this chapter that explain how to write a socket listener.
- Call the
POpenSkt
function to open a socket from which to send an Echo Request packet, and assign your socket listener to that socket.- Determine the internet address of the target node to which you want to send an Echo Request packet.
You can use the Name-Binding Protocol (NBP) to get the address of the destination application for which you want to measure round-trip packet delivery, and substitute the socket ID of the AEP Echoer; the socket number of the AEP Echoer is always 4
on every node. NBP routines are described in the chapter "Name-Binding Protocol (NBP)" in this book.- Prepare the datagram to be sent to the AEP Echoer on the target node by building
a write-data structure with specific values for certain fields. You can use theBuildDDPwds
procedure for this purpose.Set the destination socket number equal to 4 to indicate that it's the Echoer socket; set the DDP protocol type field also equal to 4 to indicate that the packet belongs to the AEP implementation on the target node; set the first byte of the data portion equal to 1 to indicate that this is an Echo Request packet. Fill in the destination network number and node ID for the target system; these are the numbers that NBP returned to you (see the preceding step).
- Call the
PWriteDDP
function to send the Echo Request to the target node. As the value ofth
ewdsPointer
parameter
, specify the pointer to the write data structure that you created.