Module nix::sys::socket

source ·
Expand description

Socket interface functions

Further reading

Modules

Structs

A structure used to make room in a cmsghdr passed to recvmsg. The size and alignment match that of a cmsghdr followed by a T, but the fields are not accessible, as the actual types will change on a call to recvmsg.
Request for multicast socket operations
Request for ipv6 multicast socket operations
Hardware Address
Flags for send/recv and their relatives
Additional socket options
A wrapper around sockaddr_un.
Unix credentials of the sending process.

Enums

These constants specify the protocol family to be used in socket and socketpair
A type-safe wrapper around a single control message. More types may be added to this enum; do not exhaustively pattern-match it. Further reading
Represents a socket address
The protocol level at which to get / set socket options. Used as an argument to getsockopt and setsockopt.
Constants used in socket and socketpair to specify the protocol to use.
These constants are used to specify the communication semantics when creating a socket with socket()

Traits

Represents a socket option that can be accessed or set. Used as an argument to getsockopt
Represents a socket option that can be accessed or set. Used as an argument to setsockopt

Functions

Accept a connection on a socket
Accept a connection on a socket
Bind a name to a socket
Initiate a connection on a socket
Get the address of the peer connected to the socket fd.
Get the current address to which the socket fd is bound.
Get the current value for the requested socket option
Listen for connections on a socket
Receive data from a connection-oriented socket. Returns the number of bytes read
Receive data from a connectionless or connection-oriented socket. Returns the number of bytes read and the socket address of the sender.
Receive message in scatter-gather vectors from a socket, and optionally receive ancillary data into the provided buffer. If no ancillary data is desired, use () as the type parameter.
Send data to a connection-oriented socket. Returns the number of bytes read
Send data in scatter-gather vectors to a socket, possibly accompanied by ancillary data. Optionally direct the message at the given address, as with sendto.
Send a message to a socket
Sets the value for the requested socket option
Shut down part of a full-duplex connection.
Return the appropriate SockAddr type from a sockaddr_storage of a certain size. In C this would usually be done by casting. The len argument should be the number of bytes in the sockaddr_storage that are actually allocated and valid. It must be at least as large as all the useful parts of the structure. Note that in the case of a sockaddr_un, len need not include the terminating null.
Create an endpoint for communication
Create a pair of connected sockets

Type Definitions