//io_context provides core i/o functionality
#include<boost/asio/io_context.hpp>
#include <iostream>
#include <string>
#include <boost/array.hpp>
#include <boost/asio.hpp>
namespace net = boost::asio;
net::io_context ioc;
using namespace std;
using boost::asio::ip::udp;
int main(){
try{
boost::asio::io_context io_context;
//Create an ip::udp::socket object to receive requests on UDP port 20001.
udp::socket socket(io_context,udp::endpoint(boost::asio::ip::address().from_string("192.168.19.1"),20001));
//waiting for a client to connect
for(;;){
boost::array<char,250>received_buffer;
udp::endpoint remote_endpoint;
socket.receive_from(received_buffer,remote_endpoint);
string message="Received buffer from sender";
boost::system::error_code ignored_error;
socket.send_to(boost::asio::buffer_cast(boost::asio::buffer(message)),remote_endpoint,0);
}
}catch(exception &e){
cerr<<e.what()<<endl;
}
return 0;
}