Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Receiving datagram broadcasts...

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

I''m using MFC''s CAsyncSocket (no flames please), but you should get the idea from the code snippet what I''m doing. This code fails. It tells me I passed an invalid parameter to Bind(). Incidentally, CAsyncSocket::Create() calls Bind() on the port it''s passed. This is called in the constructor of a class inherited from CAsyncSocket. if(!CAsyncSocket::Create(m_iPort, SOCK_DGRAM)) ShowLastError(); BOOL b = TRUE; if(!SetSockOpt(SO_BROADCAST, &b, sizeof(b))) ShowLastError(); sockaddr_in sin; ZeroMemory(&sin, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_port = m_iPort; sin.sin_addr.s_addr = INADDR_ANY; if(!CAsyncSocket::Bind((SOCKADDR*)&sin, sizeof(sin))) ShowLastError();//Says "Invalid parameter" This socket would be used to receive datagram broadcasts on m_iPort, if only it would work. How do you receive datagram broadcasts? A google newsgroups search returns dozens of long threads about how to do it, but none of them work, and they''re all different... Thanks, ~BenDilts( void );

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!