Seastar
High performance C++ framework for concurrent servers
Classes | Functions
Networking

Detailed Description

Seastar provides a simple networking API, backed by two TCP/IP stacks: the POSIX stack, utilizing the kernel's BSD socket APIs, and the native stack, implement fully within seastar and able to drive network cards directly. The native stack supports zero-copy on both transmit and receive, and is implemented using seastar's high performance, lockless sharded design. The network stack can be selected with the --network-stack command-line parameter.

Classes

struct  seastar::connected_socket_input_stream_config
 
class  seastar::connected_socket
 
class  seastar::socket
 
struct  seastar::accept_result
 The result of an server_socket::accept() call. More...
 
class  seastar::server_socket
 A listening socket, waiting to accept incoming network connections. More...
 

Functions

server_socket seastar::listen (socket_address sa)
 
server_socket seastar::listen (socket_address sa, listen_options opts)
 
future< connected_socketseastar::connect (socket_address sa)
 
future< connected_socketseastar::connect (socket_address sa, socket_address local, transport proto)
 
socket seastar::make_socket ()
 
net::udp_channel seastar::make_udp_channel ()
 
net::udp_channel seastar::make_udp_channel (const socket_address &local)
 

Class Documentation

◆ seastar::connected_socket_input_stream_config

struct seastar::connected_socket_input_stream_config
Class Members
unsigned buffer_size Initial buffer size to use for input buffering.
unsigned max_buffer_size

Maximum buffer size to use for input buffering. The system will increase buffer sizes if it sees a tendency towards large requests, but will not go above this buffer size.

unsigned min_buffer_size

Minimum buffer size to use for input buffering. The system will decrease buffer sizes if it sees a tendency towards small requests, but will not go below this buffer size.

◆ seastar::accept_result

struct seastar::accept_result
Class Members
connected_socket connection The newly-accepted connection.
socket_address remote_address The address of the peer that connected to us.

Function Documentation

◆ connect() [1/2]

future<connected_socket> seastar::connect ( socket_address  sa)

Establishes a connection to a given address

Attempts to connect to the given address.

Parameters
sasocket address to connect to
Returns
a connected_socket object, or an exception

◆ connect() [2/2]

future<connected_socket> seastar::connect ( socket_address  sa,
socket_address  local,
transport  proto 
)

Establishes a connection to a given address

Attempts to connect to the given address with a defined local endpoint

Parameters
sasocket address to connect to
localsocket address for local endpoint
prototransport protocol (TCP or SCTP)
Returns
a connected_socket object, or an exception

◆ listen() [1/2]

server_socket seastar::listen ( socket_address  sa)

Listen for connections on a given port

Starts listening on a given address for incoming connections.

Parameters
sasocket address to listen on
Returns
server_socket object ready to accept connections.
See also
listen(socket_address sa, listen_options opts)

◆ listen() [2/2]

server_socket seastar::listen ( socket_address  sa,
listen_options  opts 
)

Listen for connections on a given port

Starts listening on a given address for incoming connections.

Parameters
sasocket address to listen on
optsoptions controlling the listen operation
Returns
server_socket object ready to accept connections.
See also
listen(socket_address sa)

◆ make_socket()

socket seastar::make_socket ( )

Creates a socket object suitable for establishing stream-oriented connections

Returns
a socket object that can be used for establishing connections

◆ make_udp_channel() [1/2]

net::udp_channel seastar::make_udp_channel ( )

Creates a udp_channel object suitable for sending UDP packets

The channel is not bound to a local address, and thus can only be used for sending.

Returns
a net::udp_channel object that can be used for UDP transfers.

◆ make_udp_channel() [2/2]

net::udp_channel seastar::make_udp_channel ( const socket_address local)

Creates a udp_channel object suitable for sending and receiving UDP packets

Parameters
locallocal address to bind to
Returns
a net::udp_channel object that can be used for UDP transfers.