jaganlal
May 18th, 1999, 08:56 AM
How to broadcast data using MFC (either with CSocket/CAsyncSocket)?
Pl.give a detailed explanation.URGENT
mail id : jaganlal@hotmail.com
Pl.give a detailed explanation.URGENT
mail id : jaganlal@hotmail.com
|
Click to See Complete Forum and Search --> : MFC - CSocket & CAsyncSocket jaganlal May 18th, 1999, 08:56 AM How to broadcast data using MFC (either with CSocket/CAsyncSocket)? Pl.give a detailed explanation.URGENT mail id : jaganlal@hotmail.com Dan Ramage May 18th, 1999, 09:45 AM The only "trick" to setting a socket up for broadcast is setting the socket option. Here is a snippet of code to do that: return_code = CAsyncSocket::Create( 3000, SOCK_DGRAM, FD_READ | FD_CLOSE, NULL ); if( return_code == TRUE ) { int sock_opt_value = 1; return_code = CAsyncSocket::SetSockOpt( SO_BROADCAST, &sock_opt_value, sizeof( BOOL ), SOL_SOCKET ); } I picked 3000 as the port number to broadcast on in the Create function just because it seemed like a nice high number. That's about all there is to it. Dan codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |