devela::_dep::nc::call

Function socket

pub unsafe fn socket(
    domain: i32,
    sock_type: i32,
    protocol: i32,
) -> Result<i32, i32> 
Available on crate feature dep_nc only.
Expand description

Create an endpoint for communication.

§Examples

let socket_fd = unsafe { nc::socket(nc::AF_INET, nc::SOCK_STREAM, 0) };
assert!(socket_fd.is_ok());
let socket_fd = socket_fd.unwrap();
let ret = unsafe { nc::close(socket_fd) };
assert!(ret.is_ok());