Subject: Re: [boost] Invalid arguments
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2018-07-16 03:46:43
On 12/07/2018 20:12, randy wrote:
> Iâve the following function but i get invalid arguments error , can please
> someone tell me whereâs this invalid param or argument :
Usage queries belong in the boost-users mailing list, not this one. You
should also indicate the library in the subject, eg. [asio].
> int Asio_Send_Pck(int iSendt,int Lsocket,char * Lbuff,int Len)
> session* iTempSession = reinterpret_cast<session*>(Lsocket);
This is poor design (and may be UB on some platforms). You should use a
pimpl or opaque pointer instead. (Note that there are ways to do this
even if you need to declare a pure C API.)
> boost::asio::async_write(iTempSession->socket() ,
> boost::asio::buffer(Lbuff, Len),
There are lots of things that could be wrong with this. Since you
haven't even posted the actual error you're getting or other details
about objects referenced in this call it's hard to tell for sure.
But at least one issue is that in order to conform to Asio's
WriteHandler concept you need to include
boost::asio::placeholders::bytes_transferred in your handler arguments.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk