Jump to content
  • Advertisement
Sign in to follow this  
Sagito

DirectPlay - Bad data transmition

This topic is 4447 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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:
        {
            PDPNMSG_RECEIVE     pMsg;
            TCHAR       strBuffer[4];

            pMsg = (PDPNMSG_RECEIVE) pMsgBuffer;
            DXUtil_ConvertWideStringToGenericCch( strBuffer, (WCHAR*) pMsg->pReceiveData, 4);

			for (int i = 0; i < 4; i++)
			{
				//Avoid garbage
				if (strBuffer >= 0)
				{
					msg = strBuffer;
				}
			}
 
                        //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...

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!