A note of caution.
In all but the most exceptional of cases, you will want one io_service per application.
Rather than tie the entire application to one instance of a class, which might make testing difficult, you may want to consider providing the io_service to the Foo as a dependency injection, with its lifetime controlled by main().
Example (including the fixed constructor):
#include <boost/asio.hpp>
class foo
{
public:
foo(boost::asio::io_service& ios); // Constructor.
private:
boost::asio::io_service& ios;
boost::asio::ip::udp::socket sock;
};
foo::foo(boost::asio::io_service& ios)
: ios(ios)
, sock(ios)
{
}
int main()
{
boost::asio::io_service myios;
foo f1(myios); // note - io_service is injected
foo f2(myios);
//... generate events etc
myios.run();
// now destroy foos and lastly, myios
}