# DirectPlay - Bad data transmition

## Recommended Posts

Hi all... I've been trying to establish a peer-2-peer connection using DirectPlay for a simple console sample game. So, I need to send a message to the other computer, everytime a player made its move. This message is an array of 4 chars. I'm sending it w/ DirectPlay's SendTo function, which looks like this:
if( FAILED( hr = pDP->SendTo( DPNID_ALL_PLAYERS_GROUP,
&dpnBuffer,
1,
0,
NULL,
phAsync, DPNSEND_PRIORITY_HIGH | DPNSEND_GUARANTEED | DPNSEND_NOLOOPBACK)))


But when I receive it in the other computer, the msg is filled with zeros. I'm receiving the message through the DirectPlayMessageHandler, which is the following:
        case DPN_MSGID_RECEIVE:
{
TCHAR       strBuffer[4];

for (int i = 0; i < 4; i++)
{
//Avoid garbage
if (strBuffer[i] >= 0)
{
msg[i] = strBuffer[i];
}
}

//Check it up
cout << msg[0] << msg[1] << msg[2] << msg[3] << endl;
break;
}


Can someone tell me why this happens? What am I doing wrong here? =S Thanks everyone...

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627682
• Total Posts
2978614

• 13
• 12
• 10
• 12
• 22