|
Boost : |
From: Me here (rhjrjlbk2002_at_[hidden])
Date: 2008-04-17 08:37:11
Hi,
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
supplied".
Where's the fault? Can someone help please?
Alexander
----------- sample code -------------
#include <iostream>
#include <boost/asio.hpp>
using boost::asio::ip::udp;
int main(int argc, char* argv[])
{
try
{
boost::asio::io_service io_service;
udp::endpoint sender_endpoint( udp::v4(), 7000 );
udp::socket socket(io_service);
socket.open( 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. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk