Advertisement Jump to content
Sign in to follow this  

Winsock in DirectX, need help!

This topic is 4886 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

Hello everyone, I am a newbei in DirectX. I use QNX to do calculation, and then transmit the calculated data to windows so that a graphic is dislayed with DirectX. I have the following code, but it doesn't work: INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, INT ) { wVersionRequested = MAKEWORD(2,0); WSAStartup(wVersionRequested, &wsaData); // bzero(&address, 0, sizeof(address)); socket_descriptor=socket(AF_INET, SOCK_DGRAM,IPPROTO_UDP); memset(&address, 0, sizeof(address)); address.sin_family = AF_INET; address.sin_addr.s_addr=htonl(INADDR_ANY); address.sin_port=htons(port); length=sizeof(address); bind(socket_descriptor, (struct sockaddr *)&address, sizeof(address)); whicle(1) { recvfrom(socket_descriptor, (char *)q, sizeof(q), 0, (struct sockaddr *)&fromaddr, &fromlength); // display graphic } } What I want to do is receive data and then display graphic. The winsock code works well in a regular C++ program, but it doesn't work in DirectX code above. How is winsock OR network used in DirectX? What's wrong here? Any answer is welcome. Thanks.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!