This method of the DirectPlay2 Class retrieves a message from the message queue.
public void receive(int[] fromPlayerId, int[] toPlayerId, int flags, yte[] data, int[] dataSize);
fromPlayerId | A array that receives the player ID of the sender of the message. |
toPlayerId | An array that receives the player ID of the receiver of the message. |
flags | One or more values of DPRECEIVE_ type. Both DPRECEIVE_TOPLAYER and DPRECEIVE_FROMPLAYER can be specified, in which case receive will return whichever message is encountered first. |
data | Array variable that receives the message data. |
dataSize | The length of the array assigned to the data parameter. |
Any message received from player ID DPID_SYSMSG is a system message that is generated by the host. For such messages, the application should interpret data as a generic system message and check for the type of message before processing it.
Messages that were sent to player ID DPID_SYSMSG as a way to broadcast them to all players, or to a group ID to send them to all the players in the group, still appear to come from the sending player ID. An application will only receive messages directed to a local player. A player cannot receive a message where the sender and receiver IDs are the same.
If DPSESSION_NOMESSAGEID is specified in the session description, the LPID_FROM and LPID_TO variables are meaningless.
All the service providers shipped with DirectPlay perform integrity checks on the data to protect against corruption. Any message received will be verified. If data corruption is detected, the message will either be thrown away (if it was sent nonguaranteed) or it will be retransmitted (if it was sent guaranteed).