मैंने हाल ही में बूस्ट असियो के साथ काम करना शुरू किया। मैंने देखा कि receive method of a TCP socket पैरामीटर के रूप में message_flags स्वीकार करता है। हालांकि, संदेश_फ्लैग के लिए जो दस्तावेज़ मैंने पाया है, केवल यह कहता है कि वैध मान निर्दिष्ट किए बिना यह एक पूर्णांक है। संदेश_फ्लैग को असाइन किए जाने वाले मान क्या हैं और उनका क्या अर्थ है?बूस्ट Asio message_flags
9
A
उत्तर
11
मैंने थोड़ी देर की खोज की और आखिर में बूस्ट के स्रोत कोड को देखने की कोशिश की। मैं 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_peek
, message_out_of_band
, और message_do_not_route
जैसे संभावित मानों हैं। मैं ये कोशिश करने जा रहा हूं और देख रहा हूं कि मैं उन्हें काम पर ला सकता हूं या नहीं।
0
मुझे एक ही समस्या का सामना करना पड़ा और मेरा समाधान अधिभार का उपयोग करना था जो संदेश_फ्लैग पैरामीटर (http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/reference/basic_datagram_socket/send_to/overload1.html) नहीं लेता है।
नकारात्मक (अधिभार अपवाद का उपयोग करता है, और does not ec परम लेने के लिए)
0
ध्वज के रूप में 0 पास करने के बारे में कैसे? क्या यह आपको वांछित व्यवहार नहीं देगा? – russoue
मैंने 0 का उपयोग किया और यह ठीक लग रहा था –