I cannot find a way to make what seems to be one of the simplest thing with the boost asio library :
Read all the data available in a serial port
For example in Qt there is a readAll()
method from QextSerialPort
.
Actually, all the examples I found are about reading a certain amount of data, or multi threaded.
In my case I need it to read the data from a GSM controller. The response size depends on the sent command and the controller context so I can't specify it.
Try this:
boost::asio::read(
sock,
boost::asio::buffer(buf),
boost::asio::transfer_at_least(1),
ec
);