tags:

views:

507

answers:

1

hello,

I would like to use a function which reads on a socket port, and gives back the control whenever an IP packet is received.

the boost::asio::ip::udp::socket has a function receive (or async_receive) that returns how many bytes were read. the doc states: Receive some data on a connected socket.

now what determines the 'some' data is unclear to me.I don't understand how to system decides whether to return or continues to wait and read incoming data, which brings me to my question:

how do I read a complete IP packet using asio ?

in java, you can call the function DatagramSocket.receive(...) which does exactly what I am trying to do.

best, Dd

+4  A: 

After one month of playing with asio, it seems that the function receive and async_receive is called whenever a complete datagram has arrived.

Dd

David