|Microsoft DirectX 9.0|
Source: (SDK root)\Samples\C++\DirectPlay\DataRelay
Executable: (SDK root)\Samples\C++\DirectPlay\Bin
Host or connect to a session in the same manner as explained in SimplePeer. When the main dialog box appears, select the target, size, rate, and timeout values. Then click Push to Send. This will send a packet of data to the target—at the rate specified—with the specified size. Using the Connection Info drop-down menu, specify a target on which you would like to periodically gather connection information.
The DataRelay sample is very similar in form to the SimplePeer sample. For detailed programming notes, see the Programming Notes section of the SimplePeer sample.
When the Push to Send button is clicked, a timer is created that goes off every number of milliseconds, as indicated by the UI.
When the timer goes off, the callback function calls the SendNetworkData function to do the following tasks.
On receipt of the g_hDPDataAvailEvent event, the ProcessNetDataProc function calls the ProcessData function, which does the following:
The DirectPlayMessageHandler function handles different kinds of messages, such as DPN_MSGID_RECEIVE and DPN_MSGID_SEND_COMPLETE.