Microsoft DirectX 8.1 (Visual Basic)

DataRelay

The DataRelay sample is similar to SimplePeer but differs by sending a packet of data to a single target (or everyone) with options specified in the dialog box's user interface (UI).

Path

Source: (SDK root)\Samples\Multimedia\VBSamples\DirectPlay\DataRelay

Executable: (SDK root)\Samples\Multimedia\VBSamples\DirectPlay\Bin

User's Guide

You can host or connect to a session in the same manner as explained in the SimplePeer sample. When the main dialog appears select the target, size, rate, and timeout values. Then click the Push to Send button. This will send a packet of data with the specified size to the target at intervals specified by the rate.

Programming Notes

The DataRelay sample is very similar in form to the SimplePeer sample. The DataRelay sample differs by sending to a single target (or everyone) a packet of data with the options specified in the dialog box's UI.

When the Push to Send button is clicked, a timer goes off at intervals depending on the number of milliseconds selected in the Rate box. When the timer goes off, the application sends the user defined data packet in the following steps.

  1. A byte array is created with the options specified in the vbDataRelay box.
  2. DirectPlay8Peer.SendTo is called and the byte array is passed. The DataRelay sample sets the flag DPNSEND_NOLOOPBACK which tells Microsoft® DirectPlay® not to send the buffer back to the sender.

The DataRelay sample handles the following messages.

See the DirectPlay8Event objects in the source code for more messages that the DataRelay sample handles.