• Advertisement
Sign in to follow this  

DirectPlay - Bad data transmition

This topic is 4238 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:
                                    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;

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
Sign in to follow this  

  • Advertisement