I want make a program to receive any UDP package sent by any sender. I do it as the instructions on the page(http://pocoproject.org/wiki/index.php/C ... ss_sockets).
I do it as the follow steps:
socket.bind( addr );
please note: addr is wildcard address: no the specific host and the certain port.
memset( buff, 0, 1024 );
while( TRUE )
socket.receiveFrom( buff, sizeof( buff ), addr );
std::cout << "Receive buff from " << addr.host().toString() << ":" <<addr.port() << "[data: " << buff << "]" <<std::endl ;
Sleep( 10 );
but the socket can't receive any data. If I change addr parameters, for example, I declare the addr like this:
Poco::Net::SocketAddress addr( "127.0.0.1", 2500 );
socket handler will work well.
If you get the answer, please note, Thanks for attention!