2011-08-17 196 views

回答

11

我搜索了一会儿,最后试图查看Boost的源代码。我发现这在socket_base.hpp

/// Bitmask type for flags that can be passed to send and receive operations. 
    typedef int message_flags; 

#if defined(GENERATING_DOCUMENTATION) 
    /// Peek at incoming data without removing it from the input queue. 
    static const int message_peek = implementation_defined; 

    /// Process out-of-band data. 
    static const int message_out_of_band = implementation_defined; 

    /// Specify that the data should not be subject to routing. 
    static const int message_do_not_route = implementation_defined; 
#else 
    BOOST_STATIC_CONSTANT(int, 
     message_peek = boost::asio::detail::message_peek); 
    BOOST_STATIC_CONSTANT(int, 
     message_out_of_band = boost::asio::detail::message_out_of_band); 
    BOOST_STATIC_CONSTANT(int, 
     message_do_not_route = boost::asio::detail::message_do_not_route); 
#endif 

在此基础上,它看起来像message_peekmessage_out_of_bandmessage_do_not_route是可能的值。我会试一试,看看我能否让他们工作。

0

这个参数是转发到系统调用。例如在Windows中,它直接转发到WSASend。应该在操作系统文档中检查param的含义:WSASend对于Windows,否则recvmsg