This method of the DirectPlay2 Class retrieves data for a group of players.
public void getGroupData(int groupId, byte[] data, int[] dataSize, int flags);
groupId | The group ID that data is being requested for. |
data | The buffer where the application-specific group data is to be written. Set this parameter to NULL to request only the size of data. The dataSize parameter will be set to the size required to hold the data. |
dataSize | The size of the buffer before the method is called. After the method returns, this parameter will be set to the size (in bytes) of the group data. If the buffer was too small (DPERR_BUFFERTOOSMALL), this parameter will be set to the buffer size required (see the note about passing null as an argument for other behavior regarding DPERR_BUFFERTOOSMALL). |
flags | If this parameter is set to 0, the remote data will be retrieved. |
DirectPlay can maintain two types of group data: local and remote. The application must specify which type of data to retrieve. Local data was set by this DirectPlay2 object by using the DPSET_LOCAL flag. Remote data might have been set by any application in the session by using the DPSET_REMOTE flag.
You can pass a null for the data buffer parameter to retrieve the size for the buffer. However, when you do this you must put the code into a try...catch block, because a DPERR_BUFFERTOOSMALL error is generated. The following example shows how you might implement a try...catch block to catch the error:
int hr=0; try { Glb.glpDPlay2.getGroupData(dpID,null, dataSize,DPGET_REMOTE); } catch (ComException e){ hr= e.getHResult();} // Check for the DPERR_BUFFERTOOSMALL error if (hr!=DPERR_BUFFERTOOSMALL){ //problem... }
com.ms.directX.DirectXConstants.DPGET_REMOTE, com.ms.directX.DirectXConstants.DPGET_LOCAL