xtd 0.2.0
Loading...
Searching...
No Matches
xtd::net::sockets::socket Class Reference
Inheritance diagram for xtd::net::sockets::socket:
xtd::object xtd::iequatable< socket > xtd::interface xtd::equality_operators< type_t, equatable_t >

Definition

Implements the Berkeley sockets interface.

Implements the Berkeley sockets interface.
Definition socket.h:73
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
#define core_export_
Define shared library export.
Definition core_export.h:13
Inheritance
xtd::objectxtd::net::sockets::socket
Header
#include <xtd/net/sockets/socket>
Namespace
xtd::net::sockets
Library
xtd.core
Remarks
The xtd::net::sockets::socket class provides a rich set of methods and properties for network communications. The xtd::net::sockets::socket class allows you to perform both synchronous and asynchronous data transfer using any of the communication protocols listed in the xtd::net::sockets::protocol_type enumeration.
The xtd::net::sockets::socket class follows the xtd naming pattern for asynchronous methods. For example, the synchronous xtd::net::sockets::receive method corresponds to the asynchronous xtd::net::sockets::begin_receive and xtd::net::sockets::end_receive methods.
If your application only requires one thread during execution, use the following methods, which are designed for synchronous operation mode.
To process communications using separate threads during execution, use the following methods, which are designed for asynchronous operation mode.
If you perform multiple asynchronous operations on a socket, they do not necessarily complete in the order in which they are started.
When you are finished sending and receiving data, use the xtd::net::sockets::socket::shutdown method to disable the xtd::net::sockets::socket. After calling xtd::net::sockets::socket::shutdown, call the xtd::net::sockets::socket::close method to release all resources associated with the xtd::net::sockets::socket.
The xtd::net::sockets::socket class allows you to configure your xtd::net::sockets::socket using the xtd::net::sockets::socket::set_socket_option method. Retrieve these settings using the xtd::net::sockets::socket::get_socket_option method.
Note
If you are writing a relatively simple application and do not require maximum performance, consider using xtd::net::sockets::tcp_client, xtd::net::sockets::tcp_listener, and xtd::net::sockets::udp_client. These classes provide a simpler and more user-friendly interface to xtd::net::sockets::socket communications.
Examples
network_stream.cpp, socket_tcp_ip_v4.cpp, socket_tcp_ip_v4_without_thread.cpp, socket_tcp_ip_v6.cpp, socket_udp_ip_v4.cpp, and socket_udp_ip_v6.cpp.

Public Constructors

 socket ()
 Initializes a new instance of the xtd::net::sockets::socket class.
 
 socket (intptr handle)
 Initializes a new instance of the xtd::net::sockets::socket class for the specified socket handle.
 
 socket (const xtd::net::sockets::socket_information &socket_information)
 Initializes a new instance of the xtd::net::sockets::socket class using the specified value returned from xtd::net::sockets::socket::duplicate_and_close.
 
 socket (xtd::net::sockets::socket_type socket_type, xtd::net::sockets::protocol_type protocol_type)
 Initializes a new instance of the xtd::net::sockets::socket class using the specified socket type and protocol. If the operating system supports IPv6, this constructor creates a dual-mode socket; otherwise, it creates an IPv4 socket.
 
 socket (xtd::net::sockets::address_family address_family, xtd::net::sockets::socket_type socket_type, xtd::net::sockets::protocol_type protocol_type)
 Initializes a new instance of the xtd::net::sockets::socket class using the specified address family, socket type and protocol.
 

Public Properties

xtd::net::sockets::address_family address_family () const noexcept
 Gets the address family of the xtd::net::sockets::socket.
 
size_t available () const
 Gets the amount of data that has been received from the network and is available to be read.
 
bool blocking () const
 Gets a value that indicates whether the xtd::net::sockets::socket is in blocking mode.
 
socketblocking (bool value)
 Sets a value that indicates whether the xtd::net::sockets::socket is in blocking mode.
 
bool connected () const noexcept
 Gets a value that indicates whether a xtd::net::sockets::socket is connected to a remote host as of the last xtd::net::sockets::socket::send or xtd::net::sockets::socket::receive operation.
 
bool dont_fragment () const
 Gets a value that specifies whether the xtd::net::sockets::socket allows Internet Protocol (IP) datagrams to be fragmented.
 
socketdont_fragment (bool value)
 Sets a value that specifies whether the xtd::net::sockets::socket allows Internet Protocol (IP) datagrams to be fragmented.
 
bool dual_mode () const
 Gets a value that specifies whether the xtd::net::sockets::socket is a dual-mode socket used for both IPv4 and IPv6.
 
socketdual_mode (bool value)
 Sets a value that specifies whether the xtd::net::sockets::socket is a dual-mode socket used for both IPv4 and IPv6.
 
bool enable_broadcast () const
 Gets a boolean value that specifies whether the xtd::net::sockets::socket can send or receive broadcast packets.
 
socketenable_broadcast (bool value)
 Sets a bool value that specifies whether the xtd::net::sockets::socket can send or receive broadcast packets.
 
bool exclusive_address_use () const
 Gets a boolean value that specifies whether the xtd::net::sockets::socket allows only one process to bind to a port.
 
socketexclusive_address_use (bool value)
 Gets a boolean value that specifies whether the xtd::net::sockets::socket allows only one process to bind to a port.
 
intptr handle () const noexcept
 Gets the operating system handle for the xtd::net::sockets::socket.
 
bool is_bound () const noexcept
 Gets a value that indicates whether the xtd::net::sockets::socket is bound to a specific local port.
 
xtd::net::sockets::linger_option linger_state () const
 Gets a value that specifies whether the xtd::net::sockets::socket will delay closing a socket in an attempt to send all pending data.
 
socketlinger_state (const xtd::net::sockets::linger_option &value)
 Sets a value that specifies whether the xtd::net::sockets::socket will delay closing a socket in an attempt to send all pending data.
 
xtd::sptr< xtd::net::end_pointlocal_end_point () const
 Gets the local endpoint.
 
bool multicast_loopback () const
 Gets a value that specifies whether outgoing multicast packets are delivered to the sending application.
 
socketmulticast_loopback (bool value)
 Sets a value that specifies whether outgoing multicast packets are delivered to the sending application.
 
bool no_delay () const
 Gets a boolean value that specifies whether the stream xtd::net::sockets::socket is using the Nagle algorithm.
 
socketno_delay (bool value)
 Gets a boolean value that specifies whether the stream xtd::net::sockets::socket is using the Nagle algorithm.
 
xtd::net::sockets::protocol_type protocol_type () const noexcept
 Gets the protocol type of the xtd::net::sockets::socket.
 
size_t receive_buffer_size () const
 Gets a value that specifies the size of the receive buffer of the xtd::net::sockets::socket.
 
socketreceive_buffer_size (size_t value)
 Sets a value that specifies the size of the receive buffer of the xtd::net::sockets::socket.
 
int32 receive_timeout () const
 Gets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::receive call will time out.
 
socketreceive_timeout (int32 value)
 Sets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::receive call will time out.
 
xtd::sptr< xtd::net::end_pointremote_end_point () const
 Gets the remote endpoint.
 
size_t send_buffer_size () const
 Gets a value that specifies the size of the send buffer of the xtd::net::sockets::socket.
 
socketsend_buffer_size (size_t value)
 Sets a value that specifies the size of the send buffer of the xtd::net::sockets::socket.
 
int32 send_timeout () const
 Gets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::send call will time out.
 
socketsend_timeout (int32 value)
 Sets a value that specifies the amount of time after which a synchronous xtd::net::sockets::socket::send call will time out.
 
xtd::net::sockets::socket_type socket_type () const noexcept
 Gets the type of the xtd::net::sockets::socket.
 
xtd::byte ttl () const
 Gets a value that specifies the Time To Live (TTL) value of Internet Protocol (IP) packets sent by the xtd::net::sockets::socket.
 
socketttl (xtd::byte value)
 Sets a value that specifies the Time To Live (TTL) value of Internet Protocol (IP) packets sent by the xtd::net::sockets::socket.
 

Public Methods

socket accept ()
 Creates a new xtd::net::sockets::socket for a newly created connection.
 
bool accept_async (xtd::net::sockets::socket_async_event_args &e)
 Begins an asynchronous operation to accept an incoming connection attempt.
 
xtd::sptr< xtd::iasync_resultbegin_accept (xtd::async_callback callback, const std::any &state)
 Begins an asynchronous operation to accept an incoming connection attempt.
 
template<typename end_point_t >
xtd::sptr< xtd::iasync_resultbegin_connect (const end_point_t &remote_end_point, xtd::async_callback callback, const std::any &state)
 Begins an asynchronous request for a remote host connection.
 
xtd::sptr< xtd::iasync_resultbegin_connect (const xtd::net::ip_address &address, uint16 port, xtd::async_callback callback, const std::any &state)
 Begins an asynchronous request for a remote host connection. The host is specified by an xtd::net::ip_address and a port number.
 
xtd::sptr< xtd::iasync_resultbegin_connect (const std::vector< xtd::net::ip_address > &addresses, uint16 port, xtd::async_callback callback, const std::any &state)
 Begins an asynchronous request for a remote host connection. The host is specified by an xtd::net::ip_address array and a port number.
 
xtd::sptr< xtd::iasync_resultbegin_connect (const xtd::string &host, uint16 port, xtd::async_callback callback, const std::any &state)
 Begins an asynchronous request for a remote host connection. The host is specified by a host name and a port number.
 
xtd::sptr< xtd::iasync_resultbegin_disconnect (bool reuse_socket, xtd::async_callback callback, const std::any &state)
 Begins an asynchronous request to disconnect from a remote endpoint.
 
xtd::sptr< xtd::iasync_resultbegin_receive (std::vector< xtd::byte > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::async_callback callback, const std::any &state)
 Begins to asynchronously receive data from a connected xtd::net::sockets::socket::socket.
 
xtd::sptr< xtd::iasync_resultbegin_receive (std::vector< xtd::byte > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::sockets::socket_error &error_code, xtd::async_callback callback, const std::any &state)
 Begins to asynchronously receive data from a connected xtd::net::sockets::socket::socket.
 
xtd::sptr< xtd::iasync_resultbegin_receive_from (std::vector< xtd::byte > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::end_point &remote_end_point, xtd::async_callback callback, const std::any &state)
 Begins to asynchronously receive data from a specified network device.
 
xtd::sptr< xtd::iasync_resultbegin_receive_message_from (std::vector< xtd::byte > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::end_point &remote_end_point, xtd::async_callback callback, const std::any &state)
 Begins to asynchronously receive the specified number of bytes of data into the specified location of the data buffer, using the specified xtd::net::sockets::socket_flags, and stores the endpoint and packet information.
 
xtd::sptr< xtd::iasync_resultbegin_send (const std::vector< xtd::byte > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::async_callback callback, const std::any &state)
 Sends data asynchronously to a connected xtd::net::sockets::socket::socket.
 
xtd::sptr< xtd::iasync_resultbegin_send (const std::vector< xtd::byte > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::sockets::socket_error &error_code, xtd::async_callback callback, const std::any &state)
 Sends data asynchronously to a connected xtd::net::sockets::socket::socket.
 
xtd::sptr< xtd::iasync_resultbegin_send_to (const std::vector< xtd::byte > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, const xtd::net::end_point &remote_end_point, xtd::async_callback callback, const std::any &state)
 Sends data asynchronously to a specific remote host.
 
template<typename end_point_t >
void bind (const end_point_t &local_end_point)
 Associates a xtd::net::sockets::socket with a local endpoint.
 
void close ()
 Closes the xtd::net::sockets::socket connection and releases all associated resources.
 
template<typename end_point_t >
void connect (const end_point_t &remote_end_point)
 Establishes a connection to a remote host.
 
void connect (const xtd::net::ip_address &address, uint16 port)
 Establishes a connection to a remote host. The host is specified by an IP address and a port number.
 
void connect (const std::vector< xtd::net::ip_address > &addresses, uint16 port)
 Establishes a connection to a remote host. The host is specified by an array of IP addresses and a port number.
 
void connect (const xtd::string &host, uint16 port)
 Establishes a connection to a remote host. The host is specified by a host name and a port number.
 
void disconnect (bool reuse_socket)
 Closes the socket connection and allows reuse of the socket.
 
socket end_accept (xtd::sptr< xtd::iasync_result > async_result)
 Asynchronously accepts an incoming connection attempt and creates a new xtd::net::sockets::socket::socket to handle remote host communication.
 
void end_connect (xtd::sptr< xtd::iasync_result > async_result)
 Ends a pending asynchronous connection request.
 
void end_disconnect (xtd::sptr< xtd::iasync_result > async_result)
 Ends a pending asynchronous disconnect request.
 
size_t end_receive (xtd::sptr< xtd::iasync_result > async_result)
 Ends a pending asynchronous read.
 
size_t end_receive (xtd::sptr< xtd::iasync_result > async_result, xtd::net::sockets::socket_error &error_code)
 Ends a pending asynchronous read.
 
size_t end_receive_from (xtd::sptr< xtd::iasync_result > async_result, xtd::sptr< xtd::net::end_point > &end_point)
 Ends a pending asynchronous read from a specific endpoint.
 
size_t end_receive_message_from (xtd::sptr< xtd::iasync_result > async_result, xtd::net::sockets::socket_flags &socket_flags, xtd::sptr< xtd::net::end_point > &end_point, xtd::net::sockets::ip_packet_information &ip_packet_information)
 Ends a pending asynchronous read from a specific endpoint. This method also reveals more information about the packet than xtd::net::sockets::socket::end_receive_from(xtd::iasync_result, xtd::net::end_point).
 
size_t end_send (xtd::sptr< xtd::iasync_result > async_result)
 Ends a pending asynchronous send.
 
size_t end_send (xtd::sptr< xtd::iasync_result > async_result, xtd::net::sockets::socket_error &error_code)
 Ends a pending asynchronous send.
 
size_t end_send_to (xtd::sptr< xtd::iasync_result > async_result)
 Ends a pending asynchronous send to a specific location.
 
bool equals (const socket &s) const noexcept override
 
size_t get_raw_socket_option (int32 socket_option_level, int32 socket_option_name, intptr option_value, size_t size_option_value) const
 Gets a socket option value using platform-specific level and name identifiers.
 
int32 get_socket_option (xtd::net::sockets::socket_option_level socket_option_level, xtd::net::sockets::socket_option_name socket_option_name) const
 Returns the value of a specified xtd::net::sockets::socket option, represented as integer.
 
xtd::net::sockets::linger_option get_socket_linger_option () const
 Returns the linger xtd::net::sockets::socket option, represented as xtd::net::sockets::linger_option.
 
xtd::net::sockets::multicast_option get_socket_multicast_option (xtd::net::sockets::socket_option_name socket_option_name) const
 Returns the multicast xtd::net::sockets::socket option, represented as xtd::net::sockets::multicast_option.
 
xtd::net::sockets::ip_v6_multicast_option get_socket_ip_v6_multicast_option (xtd::net::sockets::socket_option_name socket_option_name) const
 Returns the multicast xtd::net::sockets::socket option, represented as xtd::net::sockets::ip_v6_multicast_option.
 
size_t io_control (int32 io_control_code, std::vector< xtd::byte > &option_in_value, std::vector< xtd::byte > &option_out_value)
 Sets low-level operating modes for the xtd::net::sockets::socket using numerical control codes.
 
size_t io_control (xtd::net::sockets::io_control_code io_control_code, std::vector< xtd::byte > &option_in_value, std::vector< xtd::byte > &option_out_value)
 Sets low-level operating modes for the xtd::net::sockets::socket using xtd::net::sockets::io_control_code control codes.
 
void listen (size_t backlog)
 Places a xtd::net::sockets::socket in a listening state.
 
void listen ()
 Places a xtd::net::sockets::socket in a listening state.
 
bool poll (int32 micro_seconds, xtd::net::sockets::select_mode mode)
 Determines the status of the xtd::net::sockets::socket.
 
size_t receive (std::vector< xtd::byte > &buffer)
 Receives data from a bound xtd::net::sockets::socket into a receive buffer.
 
size_t receive (std::vector< xtd::byte > &buffer, xtd::net::sockets::socket_flags socket_flags)
 Receives data from a bound xtd::net::sockets::socket into a receive buffer, using the specified xtd::net::sockets::socket_flags.
 
size_t receive (std::vector< xtd::byte > &buffer, size_t size, xtd::net::sockets::socket_flags socket_flags)
 Receives the specified number of bytes of data from a bound xtd::net::sockets::socket into a receive buffer, using the specified xtd::net::sockets::socket_flags.
 
size_t receive (std::vector< xtd::byte > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags)
 Receives the specified number of bytes from a bound xtd::net::sockets::socket into the specified offset position of the receive buffer, using the specified xtd::net::sockets::socket_flags.
 
size_t receive (std::vector< xtd::byte > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::sockets::socket_error &error)
 Receives the specified number of bytes from a bound xtd::net::sockets::socket into the specified offset position of the receive buffer, using the specified xtd::net::sockets::socket_flags.
 
size_t receive_from (std::vector< xtd::byte > &buffer, xtd::net::end_point &remote_end_point)
 Receives data from a bound xtd::net::sockets::socket into a receive buffer.
 
size_t receive_from (std::vector< xtd::byte > &buffer, xtd::net::sockets::socket_flags socket_flags, xtd::net::end_point &remote_end_point)
 Receives data from a bound xtd::net::sockets::socket into a receive buffer.
 
size_t receive_from (std::vector< xtd::byte > &buffer, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::end_point &remote_end_point)
 Receives data from a bound xtd::net::sockets::socket into a receive buffer.
 
size_t receive_from (std::vector< xtd::byte > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::end_point &remote_end_point)
 Receives data from a bound xtd::net::sockets::socket into a receive buffer.
 
size_t receive_message_from (std::vector< xtd::byte > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::end_point &remote_end_point, xtd::net::sockets::ip_packet_information &ip_packet_information)
 
size_t send (const std::vector< xtd::byte > &buffer)
 Sends data to a connected xtd::net::sockets::socket.
 
size_t send (const std::vector< xtd::byte > &buffer, xtd::net::sockets::socket_flags socket_flags)
 Sends data to a connected xtd::net::sockets::socket using the specified xtd::net::sockets::socket_flags.
 
size_t send (const std::vector< xtd::byte > &buffer, size_t size, xtd::net::sockets::socket_flags socket_flags)
 Sends the specified number of bytes of data to a connected xtd::net::sockets::socket, using the specified xtd::net::sockets::socket_flags.
 
size_t send (const std::vector< xtd::byte > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags)
 Sends the specified number of bytes of data to a connected xtd::net::sockets::socket, starting at the specified offset, and using the specified xtd::net::sockets::socket_flags.
 
size_t send (const std::vector< xtd::byte > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, xtd::net::sockets::socket_error &error_code)
 Sends the specified number of bytes of data to a connected xtd::net::sockets::socket, starting at the specified offset, and using the specified xtd::net::sockets::socket_flags.
 
size_t send_to (const std::vector< xtd::byte > &buffer, const xtd::net::end_point &remote_end_point)
 Sends data to the specified endpoint.
 
size_t send_to (const std::vector< xtd::byte > &buffer, xtd::net::sockets::socket_flags socket_flags, const xtd::net::end_point &remote_end_point)
 Sends data to a specific endpoint using the specified xtd::net::sockets::socket_flags.
 
size_t send_to (const std::vector< xtd::byte > &buffer, size_t size, xtd::net::sockets::socket_flags socket_flags, const xtd::net::end_point &remote_end_point)
 Sends the specified number of bytes of data to the specified endpoint using the specified xtd::net::sockets::socket_flags.
 
size_t send_to (const std::vector< xtd::byte > &buffer, size_t offset, size_t size, xtd::net::sockets::socket_flags socket_flags, const xtd::net::end_point &remote_end_point)
 Sends the specified number of bytes of data to the specified endpoint, starting at the specified location in the buffer, and using the specified xtd::net::sockets::socket_flags.
 
void set_ip_protection_level (xtd::net::sockets::ip_protection_level level)
 Sets the IP protection level on a socket.
 
void set_socket_option (xtd::net::sockets::socket_option_level socket_option_level, xtd::net::sockets::socket_option_name socket_option_name, bool option_value)
 Sets the specified xtd::net::sockets::socket option to the specified integer value.
 
void set_socket_option (xtd::net::sockets::socket_option_level socket_option_level, xtd::net::sockets::socket_option_name socket_option_name, int32 option_value)
 Sets the specified xtd::net::sockets::socket option to the specified integer value.
 
void set_socket_option (xtd::net::sockets::linger_option option_value)
 Sets the linger xtd::net::sockets::socket option to the specified integer value.
 
void set_socket_option (xtd::net::sockets::socket_option_name socket_option_name, const xtd::net::sockets::multicast_option &option_value)
 Sets the linger xtd::net::sockets::socket option to the specified integer value.
 
void set_socket_option (xtd::net::sockets::socket_option_name socket_option_name, const xtd::net::sockets::ip_v6_multicast_option &option_value)
 Sets the linger xtd::net::sockets::socket option to the specified integer value.
 
void set_raw_socket_option (int32 socket_option_level, int32 socket_option_name, intptr option_value, size_t option_value_size)
 Sets a socket option value using platform-specific level and name identifiers.
 
void shutdown (xtd::net::sockets::socket_shutdown how)
 Disables sends and receives on a xtd::net::sockets::socket.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 

Public Static Properties

static bool os_supports_ip_v4 () noexcept
 Indicates whether the underlying operating system and network adaptors support Internet Protocol version 4 (IPv4).
 
static bool os_supports_ip_v6 () noexcept
 Indicates whether the underlying operating system and network adaptors support Internet Protocol version 6 (IPv6).
 

Public Static Methods

static size_t select (std::vector< socket > &check_read, std::vector< socket > &check_write, std::vector< socket > &check_error, int32 microseconds)
 Determines the status of one or more sockets.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
virtual xtd::string to_string () const noexcept
 Returns a xtd::string that represents the current object.
 
- Public Member Functions inherited from xtd::iequatable< socket >
virtual bool equals (const socket &) const noexcept=0
 Indicates wheth er the current object is equal to another object of the same type.
 
- Static Public Member Functions inherited from xtd::object
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<typename object_a_t , typename object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

The documentation for this class was generated from the following file:
  • xtd.core/include/xtd/net/sockets/socket.h