@@ -21,6 +21,8 @@ use std::os::windows::io::{FromRawSocket, IntoRawSocket};
21
21
use std:: time:: Duration ;
22
22
23
23
use crate :: sys:: { self , c_int, getsockopt, setsockopt, Bool } ;
24
+ #[ cfg( all( unix, not( target_os = "redox" ) ) ) ]
25
+ use crate :: MsgHdrMut ;
24
26
use crate :: { Domain , Protocol , SockAddr , TcpKeepalive , Type } ;
25
27
#[ cfg( not( target_os = "redox" ) ) ]
26
28
use crate :: { MaybeUninitSlice , MsgHdr , RecvFlags } ;
@@ -627,6 +629,19 @@ impl Socket {
627
629
sys:: peek_sender ( self . as_raw ( ) )
628
630
}
629
631
632
+ /// Receive a message from a socket using a message structure.
633
+ ///
634
+ /// This is not supported on Windows as calling `WSARecvMsg` (the `recvmsg`
635
+ /// equivalent) is not straight forward on Windows. See
636
+ /// <https://github.com/microsoft/Windows-classic-samples/blob/7cbd99ac1d2b4a0beffbaba29ea63d024ceff700/Samples/Win7Samples/netds/winsock/recvmsg/rmmc.cpp>
637
+ /// for an example (in C++).
638
+ #[ doc = man_links ! ( recvmsg( 2 ) ) ]
639
+ #[ cfg( all( unix, not( target_os = "redox" ) ) ) ]
640
+ #[ cfg_attr( docsrs, doc( cfg( all( unix, not( target_os = "redox" ) ) ) ) ) ]
641
+ pub fn recvmsg ( & self , msg : & mut MsgHdrMut < ' _ , ' _ , ' _ > , flags : sys:: c_int ) -> io:: Result < usize > {
642
+ sys:: recvmsg ( self . as_raw ( ) , msg, flags)
643
+ }
644
+
630
645
/// Sends data on the socket to a connected peer.
631
646
///
632
647
/// This is typically used on TCP sockets or datagram sockets which have
0 commit comments