Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

ip::tcp::socket

The TCP socket type.

typedef basic_stream_socket< tcp > socket;
Types

Name

Description

rebind_executor

Rebinds the socket type to another executor.

broadcast

Socket option to permit sending of broadcast messages.

bytes_readable

IO control command to get the amount of data that can be read without blocking.

debug

Socket option to enable socket-level debugging.

do_not_route

Socket option to prevent routing, use local interfaces only.

enable_connection_aborted

Socket option to report aborted connections on accept.

endpoint_type

The endpoint type.

executor_type

The type of the executor associated with the object.

keep_alive

Socket option to send keep-alives.

linger

Socket option to specify whether the socket lingers on close if unsent data is present.

lowest_layer_type

A basic_socket is always the lowest layer.

message_flags

Bitmask type for flags that can be passed to send and receive operations.

native_handle_type

The native representation of a socket.

out_of_band_inline

Socket option for putting received out-of-band data inline.

protocol_type

The protocol type.

receive_buffer_size

Socket option for the receive buffer size of a socket.

receive_low_watermark

Socket option for the receive low watermark.

reuse_address

Socket option to allow the socket to be bound to an address that is already in use.

send_buffer_size

Socket option for the send buffer size of a socket.

send_low_watermark

Socket option for the send low watermark.

shutdown_type

Different ways a socket may be shutdown.

wait_type

Wait types.

Member Functions

Name

Description

assign

Assign an existing native socket to the socket.

async_connect

Start an asynchronous connect.

async_read_some

Start an asynchronous read.

async_receive

Start an asynchronous receive.

async_send

Start an asynchronous send.

async_wait

Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions.

async_write_some

Start an asynchronous write.

at_mark

Determine whether the socket is at the out-of-band data mark.

available

Determine the number of bytes available for reading.

basic_stream_socket [constructor]

Construct a basic_stream_socket without opening it.

Construct and open a basic_stream_socket.

Construct a basic_stream_socket, opening it and binding it to the given local endpoint.

Construct a basic_stream_socket on an existing native socket.

Move-construct a basic_stream_socket from another.

Move-construct a basic_stream_socket from a socket of another protocol type.

bind

Bind the socket to the given local endpoint.

cancel

Cancel all asynchronous operations associated with the socket.

close

Close the socket.

connect

Connect the socket to the specified endpoint.

get_executor

Get the executor associated with the object.

get_option

Get an option from the socket.

io_control

Perform an IO control command on the socket.

is_open

Determine whether the socket is open.

local_endpoint

Get the local endpoint of the socket.

lowest_layer

Get a reference to the lowest layer.

Get a const reference to the lowest layer.

native_handle

Get the native socket representation.

native_non_blocking

Gets the non-blocking mode of the native socket implementation.

Sets the non-blocking mode of the native socket implementation.

non_blocking

Gets the non-blocking mode of the socket.

Sets the non-blocking mode of the socket.

open

Open the socket using the specified protocol.

operator=

Move-assign a basic_stream_socket from another.

Move-assign a basic_stream_socket from a socket of another protocol type.

read_some

Read some data from the socket.

receive

Receive some data on the socket.

Receive some data on a connected socket.

release

Release ownership of the underlying native socket.

remote_endpoint

Get the remote endpoint of the socket.

send

Send some data on the socket.

set_option

Set an option on the socket.

shutdown

Disable sends or receives on the socket.

wait

Wait for the socket to become ready to read, ready to write, or to have pending error conditions.

write_some

Write some data to the socket.

~basic_stream_socket [destructor]

Destroys the socket.

Data Members

Name

Description

max_connections [static]

(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections.

max_listen_connections [static]

The maximum length of the queue of pending incoming connections.

message_do_not_route [static]

Specify that the data should not be subject to routing.

message_end_of_record [static]

Specifies that the data marks the end of a record.

message_out_of_band [static]

Process out-of-band data.

message_peek [static]

Peek at incoming data without removing it from the input queue.

The basic_stream_socket class template provides asynchronous and blocking stream-oriented socket functionality.

Thread Safety

Distinct objects: Safe.

Shared objects: Unsafe.

Synchronous send, receive, connect, and shutdown operations are thread safe with respect to each other, if the underlying operating system calls are also thread safe. This means that it is permitted to perform concurrent calls to these synchronous operations on a single socket object. Other synchronous operations, such as open or close, are not thread safe.

Requirements

Header: boost/asio/ip/tcp.hpp

Convenience header: boost/asio.hpp


PrevUpHomeNext