Winsock in DirectX, need help!
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement