Boost logo

Boost :

From: Me here (rhjrjlbk2002_at_[hidden])
Date: 2008-04-17 08:37:11


I'm writing program with asio from 1.35.0 to read the
data from a hardware device which sends data to my PC
to port 7000. The sample below fails on Windows with
exception code 10022, text "An invalid argument was

Where's the fault? Can someone help please?


----------- sample code -------------
#include <iostream>
#include <boost/asio.hpp>

using boost::asio::ip::udp;

int main(int argc, char* argv[])
    boost::asio::io_service io_service;

    udp::endpoint sender_endpoint( udp::v4(), 7000 );

    udp::socket socket(io_service); udp::v4() );

    char packet[1024];

    size_t len = socket.receive_from(
        boost::asio::buffer(packet), sender_endpoint);

    std::cout << "Works\n";
  catch(const std::exception& e)
    std::cerr << e.what() << std::endl;
  return 0;

Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

Boost list run by bdawes at, gregod at, cpdaniel at, john at