|
Boost : |
Subject: Re: [boost] Boost ASIO - Client Request TCP Help..!!
From: Rahul Mathur (srivmuk_at_[hidden])
Date: 2013-10-14 02:32:31
In continuation of above original code, as send() static API worked fine,
now to to set "Keep Alive Option" for the socket, I did tried as -
--- int sockKeepAliveOption = 1; int n2 = setsockopt(socket.native(), SOL_SOCKET, SO_SNDTIMEO, &sockKeepAliveOption, sizeof(sockKeepAliveOption)); if(n2 == -1) std::cout << "Setsocket option Err: SO_KEEPALIVE -- unable to set keep alive tcp connection." << std::endl; else std::cout << "S0_KEEPALIVE set, with SOL_SOCKET --- Keep Alive option set." << std::endl; --- It goes to if condition of "n2 = -1", i.e unable to set keep alive tcp connection. Please suggest - How can I correct above to have "Keep Alive option set". Thanks!! On Sat, Oct 12, 2013 at 6:35 PM, Joseph Van Riper < fleeb.fantastique_at_[hidden]> wrote: > On Fri, Oct 11, 2013 at 11:58 PM, Rahul Mathur <srivmuk_at_[hidden]> wrote: > > > YES, I did tried earlier and it did worked BTW, how to know which are > > relative and static functions. > > > As you look at the Asio reference, you'll see that there are 'Free > functions'. Those are going to be static functions. Anything else > requires an instance of a class. > > I think you could have also used: > > boost::asio::write( socket, boost::asio::buffer( &pf, sizeof(pf)), ec ); > > if you wanted to use free functions instead of the class's .send() > function. > > - Trey > > _______________________________________________ > Unsubscribe & other changes: > http://lists.boost.org/mailman/listinfo.cgi/boost >
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk