diff options
-rw-r--r-- | sys_util/src/net.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys_util/src/net.rs b/sys_util/src/net.rs index a2de0c4..341bbfa 100644 --- a/sys_util/src/net.rs +++ b/sys_util/src/net.rs @@ -198,7 +198,7 @@ impl UnixSeqpacket { } } - /// Read data from the socket fd to a given buffer + /// Receive data from the socket fd to a given buffer. /// /// # Arguments /// * `buf` - A mut reference to the data buffer. @@ -207,11 +207,11 @@ impl UnixSeqpacket { /// * `usize` - The size of bytes read to the buffer. /// /// # Errors - /// Returns error when `libc::read` failed. + /// Returns error when `libc::recv` failed. pub fn recv(&self, buf: &mut [u8]) -> io::Result<usize> { // Safe since we make sure the input `count` == `buf.len()` and handle the returned error. unsafe { - let ret = libc::read(self.fd, buf.as_mut_ptr() as *mut _, buf.len()); + let ret = libc::recv(self.fd, buf.as_mut_ptr() as *mut _, buf.len(), 0); if ret < 0 { Err(io::Error::last_os_error()) } else { |