Microsoft DirectX 8.1 (C++) |
The DataRelay sample is similar to SimplePeer but differs by sending a packet of data with options specified in the dialog box's user interface.
Source: (SDK root)\Samples\Multimedia\DirectPlay\DataRelay
Executable: (SDK root)\Samples\Multimedia\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 specified rate and 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 details, see the "Programming Notes" section of the SimplePeer sample.
When the Push to Send button is clicked, then a timer is created that goes off every number of milliseconds, as indicated by the user interface (UI).
When the timer goes off, the callback function calls the SendNetworkData function to do the following tasks:
Upon 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_MGSID_RECEIVE and DPN_MSGID_SEND_COMPLETE.