本文簡要介紹rust語言中 std::os::unix::net::UnixStream.set_passcred
的用法。
用法
pub fn set_passcred(&self, passcred: bool) -> Result<()>
移動套接字以在 SocketAncillary
中將 unix 憑據作為控製消息傳遞。
設置套接字選項 SO_PASSCRED
。
例子
#![feature(unix_socket_ancillary_data)]
use std::os::unix::net::UnixStream;
fn main() -> std::io::Result<()> {
let socket = UnixStream::connect("/tmp/sock")?;
socket.set_passcred(true).expect("Couldn't set passcred");
Ok(())
}
相關用法
- Rust UnixStream.set_write_timeout用法及代碼示例
- Rust UnixStream.set_read_timeout用法及代碼示例
- Rust UnixStream.set_nonblocking用法及代碼示例
- Rust UnixStream.send_vectored_with_ancillary用法及代碼示例
- Rust UnixStream.shutdown用法及代碼示例
- Rust UnixStream.take_error用法及代碼示例
- Rust UnixStream.read_timeout用法及代碼示例
- Rust UnixStream.peer_addr用法及代碼示例
- Rust UnixStream.peek用法及代碼示例
- Rust UnixStream.connect用法及代碼示例
- Rust UnixStream.local_addr用法及代碼示例
- Rust UnixStream.recv_vectored_with_ancillary用法及代碼示例
- Rust UnixStream.pair用法及代碼示例
- Rust UnixStream.write_timeout用法及代碼示例
- Rust UnixStream.connect_addr用法及代碼示例
- Rust UnixStream.try_clone用法及代碼示例
- Rust UnixStream.peer_cred用法及代碼示例
- Rust UnixStream用法及代碼示例
- Rust UnixListener.accept用法及代碼示例
- Rust UnixListener.bind用法及代碼示例
- Rust UnixDatagram.peek_from用法及代碼示例
- Rust UnixDatagram.recv_from用法及代碼示例
- Rust UnixListener.incoming用法及代碼示例
- Rust UnixDatagram.take_error用法及代碼示例
- Rust UnixDatagram.peek用法及代碼示例
注:本文由純淨天空篩選整理自rust-lang.org大神的英文原創作品 std::os::unix::net::UnixStream.set_passcred。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。