Struct lrs::socket::Socket

A Socket

Syntax

struct Socket {
    /* private fields */
}

Static methods

NameDescription
ipv4_datagram

Creates an Ipv4/Udp socket.

ipv4_raw

Creates a raw Ipv4 socket.

ipv4_stream

Creates an Ipv4/Tcp socket.

ipv6_datagram

Creates an Ipv6/Udp socket.

ipv6_raw

Creates a raw Ipv6 socket.

ipv6_stream

Creates an Ipv6/Tcp socket.

netlink

Creates a new Netlink socket.

new

Creates a new socket.

unix_datagram

Creates a Unix/Udp socket.

unix_seqpacket

Creates a Unix/SeqPacket socket.

unix_stream

Creates a Unix/Tcp socket.

Methods

ReceiverNameDescription
&selfaccept

Accepts a new connection on the socket.

&selfaccept_addr

Accepts a new connection on the socket and returns the peer's address.

&selfaccepts_connections

Retrieves whether this socket has been set up to accept connections.

&selfbind

Binds the socket to an address.

&selfbind_to_device

Binds this socket to a device so that only packets from this device will be accepted.

&selfconnect

Connects this socket to a peer.

&selfdevice

Retrieves the name of the device this socket is bound to, if any.

The buffer in which the device name will be stored.

&selfdisconnect

Disconnects a connected, connection-less socket.

&selfdomain

Retrieves the domain of this socket.

&selferror

Retrieves the last pending socket error.

&selfforce_set_recv_buffer_size

Sets the maximal receive buffer size of this socket, overriding normal system limits.

&selfforce_set_send_buffer_size

Sets the maximal send buffer size of this socket, overriding normal system limits.

&selfgather_send

Gathers a message from multiple sources and sends it on a connected socket.

&selfgather_send_to

Gathers a message from multiple sources and sends it on a connection-less socket.

&selfget_addr

Retrieves the address the socket is bound to.

&selfget_peer_addr

Retrieves the address of the peer this socket is connected to, if any.

&selfipv4_add_multicast_source

Sets the socket up to accept multicast messages from a particular source.

&selfipv4_block_multicast_peer

Blocks messages from a peer in a multicast group.

&selfipv4_hop_limit

Retrieves the hop limit of Ipv4 packets sent over this socket.

&selfipv4_is_header_included

Retrieves whether packets sent over this socket already have a header included.

&selfipv4_is_multicast_all

Retrieves whether this socket receives all messages sent to any multicast groups that any socket on this system is a member of.

  • ip(7) and IP_MULTICAST_ALL therein

&selfipv4_is_multicast_loop

Retrieves whether multicast packets sent from this socket are looped back to local sockets.

&selfipv4_is_receive_options

Retrieves whether all received messages are accompanied by an options control message.

&selfipv4_is_receive_raw_options

Retrieves whether all received messages are accompanied by an options control message.

&selfipv4_join_multicast_group

Joins a multicast group.

&selfipv4_leave_multicast_group

Leaves a multicast group.

&selfipv4_mtu

Retrieves the MTU of this socket.

&selfipv4_multicast_hop_limit

Retrieves the hop limit of Ipv4 multicast packets sent over this socket.

&selfipv4_options

Retrieves the Ipv4 options sent with each packet sent over this socket.

&selfipv4_remove_multicast_source

Removes a previously added source of multicast messages.

&selfipv4_set_header_included

Sets whether packets sent over this socket already have a header included.

&selfipv4_set_hop_limit

Sets the hop limit of Ipv4 packets sent over this socket.

&selfipv4_set_multicast_all

Sets whether this socket receives all messages sent to any multicast groups that any socket on this system is a member of.

&selfipv4_set_multicast_hop_limit

Sets the hop limit of Ipv4 multicast packets sent over this socket.

&selfipv4_set_multicast_loop

Sets whether multicast packets sent from this socket are looped back to local sockets.

&selfipv4_set_options

Sets the Ipv4 options sent with each packet sent over this socket.

&selfipv4_set_receive_options

Sets whether all received messages are accompanied by an options control message.

&selfipv4_set_receive_raw_options

Sets whether all received messages are accompanied by an options control message.

&selfipv4_unblock_multicast_peer

Unblocks messages from a peer in a multicast group.

&selfipv6_hop_limit

Retrieves the hop limit of packets sent over this socket.

&selfipv6_into_ipv4

Turns an Ipv6 socket into an Ipv4 socket.

&selfipv6_is_ipv6_only

Retrieves whether this socket only handles Ipv6 packets.

&selfipv6_is_multicast_loop

Retrieves whether multicast packets sent from this socket are looped back to local sockets.

&selfipv6_join_multicast_group

Joins a multicast group.

&selfipv6_leave_multicast_group

Leaves a multicast group.

&selfipv6_mtu

Retrieves the MTU of this socket.

&selfipv6_multicast_hop_limit

Retrieves the hop limit of multicast packets sent over this socket.

&selfipv6_set_hop_limit

Sets the hop limit of packets sent over this socket.

&selfipv6_set_ipv6_only

Sets whether this socket only handles Ipv6 packets.

&selfipv6_set_mtu

Sets the MTU of this socket.

&selfipv6_set_multicast_hop_limit

Sets the hop limit of multicast packets sent over this socket.

&selfipv6_set_multicast_loop

Sets whether multicast packets sent from this socket are looped back to local sockets.

&selfis_broadcast

Retrieves whether this socket allows broadcasting.

&selfis_debug

Retrieves whether this socket is in debug mode.

&selfis_dont_route

Retrieves whether this socket only sends packets to directly connected hosts.

&selfis_keep_alive

Retrieves whether this socket sends keep-alive messages.

&selfis_oob_inline

Retrieves whether this socket places out-of-band data directly into the data stream.

&selfis_receive_credentials

Retrieves whether this socket accepts credentials control messages.

&selfis_reuse_addr
&selfis_reuse_port
&selfis_timestamp

Retrieves whether this socket sends timestamp control messages.

&selfkind

Retrieves the kind of the socket.

&selflast_packet

Retrieves the time the last packet was received.

&selflinger

Retrieves the linger setting of this socket.

&selflisten

Marks this socket as accepting incoming connections.

&selfmark

Retrieves the mark of the packets sent over this socket.

&selfpeek_offset

Retrieves the peek offset of this socket.

&selfpeer_credentials

Retrieves the credentials of a connected peer.

&selfpending_input

Retrieves the amount of available data.

&selfpending_output

Retrieves the amount of data not yet successfully sent.

&selfpriority

Retrieves the priority of packets sent over this socket.

&selfprotocol

Retrieves the protocol of this socket.

&selfrecv

Receives a message on a connected socket.

&selfrecv_buffer_size

Retrieves the maximal receive buffer size of this socket.

&selfrecv_from

Receives a message on a connection-less socket.

&selfrecv_msg

Receives a message, control messages, and the senders address.

&selfrecv_timeout

Retrieves the timeout option of receiving operations.

&selfscatter_recv

Receives a message on a connected socket and stores it in multiple buffers.

&selfsend

Sends a message over a connected socket.

&selfsend_buffer_size

Retrieves the maximal send buffer size of this socket.

&selfsend_ctrl

Gathers a message from multiple source and sends it together with a control message on a connected socket.

&selfsend_ctrl_to

Gathers a message from multiple source and sends it together with a control message on a connection-less socket.

&selfsend_timeout

Retrieves the timeout option of sending operations.

&selfsend_to

Sends a message on a connection-less socket.

&selfset_broadcast

Enables or disables broadcasting for this socket.

&selfset_debug

Enables or disables debug mode for this socket.

&selfset_dont_route

Sets whether this socket only sends packets to directly connected hosts.

&selfset_keep_alive

Sets whether this socket sends keep-alive messages.

&selfset_linger

Sets the linger setting of this socket.

&selfset_mark

Sets the mark of the packets sent over this socket.

&selfset_oob_inline

Sets whether this socket places out-of-band data directly into the data stream.

&selfset_peek_offset

Sets the peek offset of this socket.

&selfset_priority

Sets the priority of packets sent over this socket.

&selfset_receive_credentials

Sets whether this socket accepts credentials control messages.

&selfset_recv_buffer_size

Sets the maximal receive buffer size of this socket.

&selfset_recv_timeout

Sets the timeout option of receiving operations.

&selfset_reuse_addr
&selfset_reuse_port
&selfset_send_buffer_size

Sets the maximal send buffer size of this socket.

&selfset_send_timeout

Sets the timeout option of sending operations.

&selfset_timestamp

Sets whether this socket sends timestamp control messages.

&selfshutdown

Shuts down the receiving and sending ends of a connected socket.

&selfshutdown_incoming

Shuts down the receiving end of a connected socket.

&selfshutdown_outgoing

Shuts down the sending end of a socket.

&selftcp_is_cork

Retrieves the status of the tcp_cork option.

&selftcp_set_cork

Sets the status of the tcp_cork option.

&selfudp_is_cork

Retrieves the status of the udp_cork option.

&selfudp_set_cork

Sets the status of the udp_cork option.

Trait implementations

NameDescription
Drop

Objects with a destructor.

FDContainer

Objects that are file descriptor wrappers.

UndefState

Types that are not valid when they contain certain bit patterns.

Remarks

This type provides access to the Linux socket interface.

See also