Skip to main content

Module socket

Module socket 

Source
Expand description

Socket interface functions

Further reading

Modules§

sockopt
Socket options as used by setsockopt and getsockopt.

Structs§

Backlog
IpMembershipRequest
Request for multicast socket operations
Ipv6MembershipRequest
Request for ipv6 multicast socket operations
LinkAddr
Hardware Address
MsgFlags
Flags for send/recv and their relatives
SockFlag
Additional socket options
SockaddrIn
An IPv4 socket address
SockaddrIn6
An IPv6 socket address
UnixAddr
A wrapper around sockaddr_un.
sockaddr
sockaddr_in
sockaddr_in6
sockaddr_storage
sockaddr_un

Enums§

AddressFamily
These constants specify the protocol family to be used in socket and socketpair
Shutdown
SockProtocol
Constants used in socket and socketpair to specify the protocol to use.
SockType
These constants are used to specify the communication semantics when creating a socket with socket()

Traits§

GetSockOpt
Represents a socket option that can be retrieved.
SetSockOpt
Represents a socket option that can be set.
SockaddrLike
Anything that, in C, can be cast back and forth to sockaddr.

Functions§

accept
Accept a connection on a socket
accept4
Accept a connection on a socket
bind
Bind a name to a socket
connect
Initiate a connection on a socket
getpeername
Get the address of the peer connected to the socket fd.
getsockname
Get the current address to which the socket fd is bound.
getsockopt
Get the current value for the requested socket option
listen
Listen for connections on a socket
recv
Receive data from a connection-oriented socket. Returns the number of bytes read
recvfrom
Receive data from a connectionless or connection-oriented socket. Returns the number of bytes read and, for connectionless sockets, the socket address of the sender.
send
Send data to a connection-oriented socket. Returns the number of bytes read
sendto
Send a message to a socket
setsockopt
Sets the value for the requested socket option
shutdown
Shut down part of a full-duplex connection.
socket
Create an endpoint for communication
socketpair
Create a pair of connected sockets

Type Aliases§

sa_family_t

Unions§

SockaddrStorage
A container for any sockaddr type