5#include <system/collections/ilist.h>
6#include <system/enum_helpers.h>
7#include <system/idisposable.h>
8#include <system/shared_ptr.h>
9#include <system/details/array_view.h>
11#include <net/end_point.h>
12#include <net/ip_address.h>
13#include <net/linger_option.h>
14#include <net/socket_type.h>
15#include <net/sockets/address_family.h>
16#include <net/sockets/io_control_code.h>
17#include <net/sockets/ip_packet_information.h>
18#include <net/sockets/protocol_type.h>
19#include <net/sockets/select_mode.h>
20#include <net/sockets/socket_error.h>
21#include <net/sockets/socket_flags.h>
22#include <net/sockets/socket_option_level.h>
23#include <net/sockets/socket_option_name.h>
24#include <net/sockets/socket_shutdown.h>
25#include <system/array_segment.h>
28namespace System {
namespace Details {
29ASPOSECPP_3RD_PARTY_CLASS(io_service_impl);
30ASPOSECPP_3RD_PARTY_CLASS(socket_impl);
33namespace System {
namespace Net {
namespace Sockets {
38 friend class SocketAsyncResult;
39 friend class SocketCompletionHandler;
47 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
49 ASPOSECPP_SHARED_RTTI_INFO_DECL();
138 ASPOSECPP_SHARED_API
void set_Ttl(int16_t value);
278 ASPOSECPP_SHARED_API
void Close(
int timeout);
286 ASPOSECPP_SHARED_API
void Listen(int32_t backlog);
301 ASPOSECPP_SHARED_API int32_t
Send(System::Details::ArrayView<uint8_t> buffer, int32_t size,
SocketFlags socketFlags);
307 template<std::
size_t N>
308 int32_t
Send(System::Details::StackArray<uint8_t, N> &buffer, int32_t size,
SocketFlags socketFlags)
310 return Send(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), size, socketFlags);
322 ASPOSECPP_SHARED_API int32_t
Send(System::Details::ArrayView<uint8_t> buffer,
SocketFlags socketFlags);
327 template<std::
size_t N>
328 int32_t
Send(System::Details::StackArray<uint8_t, N> &buffer,
SocketFlags socketFlags)
330 return Send(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), socketFlags);
340 ASPOSECPP_SHARED_API int32_t
Send(System::Details::ArrayView<uint8_t> buffer);
344 template<std::
size_t N>
345 int32_t
Send(System::Details::StackArray<uint8_t, N> &buffer)
347 return Send(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer));
381 ASPOSECPP_SHARED_API int32_t
Send(System::Details::ArrayView<uint8_t> buffer, int32_t offset, int32_t size,
389 template<std::
size_t N>
390 int32_t
Send(System::Details::StackArray<uint8_t, N> &buffer, int32_t offset, int32_t size,
SocketFlags socketFlags)
392 return Send(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), offset, size, socketFlags);
411 ASPOSECPP_SHARED_API int32_t
Send(System::Details::ArrayView<uint8_t> buffer, int32_t offset, int32_t size,
420 template<std::
size_t N>
421 int32_t
Send(System::Details::StackArray<uint8_t, N> &buffer, int32_t offset, int32_t size,
424 return Send(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), offset, size, socketFlags, errorCode);
443 ASPOSECPP_SHARED_API int32_t
SendTo(System::Details::ArrayView<uint8_t> buffer, int32_t offset, int32_t size,
452 template<std::
size_t N>
453 int32_t
SendTo(System::Details::StackArray<uint8_t, N> &buffer, int32_t offset, int32_t size,
456 return SendTo(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), offset, size, socketFlags, remoteEP);
473 ASPOSECPP_SHARED_API int32_t
SendTo(System::Details::ArrayView<uint8_t> buffer, int32_t size,
SocketFlags socketFlags,
481 template<std::
size_t N>
482 int32_t
SendTo(System::Details::StackArray<uint8_t, N> &buffer, int32_t size,
SocketFlags socketFlags,
485 return SendTo(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), size, socketFlags, remoteEP);
500 ASPOSECPP_SHARED_API int32_t
SendTo(System::Details::ArrayView<uint8_t> buffer,
SocketFlags socketFlags,
507 template<std::
size_t N>
511 return SendTo(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), socketFlags, remoteEP);
527 template<std::
size_t N>
530 return SendTo(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), remoteEP);
543 ASPOSECPP_SHARED_API int32_t
Receive(System::Details::ArrayView<uint8_t> buffer, int32_t size,
SocketFlags socketFlags);
549 template<std::
size_t N>
550 int32_t
Receive(System::Details::StackArray<uint8_t, N> &buffer, int32_t size,
SocketFlags socketFlags)
552 return Receive(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), size, socketFlags);
563 ASPOSECPP_SHARED_API int32_t
Receive(System::Details::ArrayView<uint8_t> buffer,
SocketFlags socketFlags);
568 template<std::
size_t N>
571 return Receive(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), socketFlags);
580 ASPOSECPP_SHARED_API int32_t
Receive(System::Details::ArrayView<uint8_t> buffer);
584 template<std::
size_t N>
585 int32_t
Receive(System::Details::StackArray<uint8_t, N> &buffer)
587 return Receive(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer));
605 ASPOSECPP_SHARED_API int32_t
Receive(System::Details::ArrayView<uint8_t> buffer, int32_t offset, int32_t size,
614 template<std::
size_t N>
615 int32_t
Receive(System::Details::StackArray<uint8_t, N> &buffer, int32_t offset, int32_t size,
618 return Receive(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), offset, size, socketFlags);
638 ASPOSECPP_SHARED_API int32_t
Receive(System::Details::ArrayView<uint8_t> buffer, int32_t offset, int32_t size,
648 template<std::
size_t N>
649 int32_t
Receive(System::Details::StackArray<uint8_t, N> &buffer, int32_t offset, int32_t size,
652 return Receive(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), offset, size, socketFlags, errorCode);
692 ASPOSECPP_SHARED_API int32_t
ReceiveMessageFrom(System::Details::ArrayView<uint8_t> buffer, int32_t offset, int32_t size,
704 template<std::
size_t N>
705 int32_t
ReceiveMessageFrom(System::Details::StackArray<uint8_t, N> &buffer, int32_t offset, int32_t size,
709 return ReceiveMessageFrom(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), offset, size,
710 socketFlags, remoteEP, ipPacketInformation);
730 ASPOSECPP_SHARED_API int32_t
ReceiveFrom(System::Details::ArrayView<uint8_t> buffer, int32_t offset, int32_t size,
740 template<std::
size_t N>
741 int32_t
ReceiveFrom(System::Details::StackArray<uint8_t, N> &buffer, int32_t offset, int32_t size,
744 return ReceiveFrom(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), offset, size,
745 socketFlags, remoteEP);
763 ASPOSECPP_SHARED_API int32_t
ReceiveFrom(System::Details::ArrayView<uint8_t> buffer, int32_t size,
SocketFlags socketFlags,
772 template<std::
size_t N>
776 return ReceiveFrom(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), size, socketFlags, remoteEP);
797 template<std::
size_t N>
801 return ReceiveFrom(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), socketFlags, remoteEP);
817 template<std::
size_t N>
820 return ReceiveFrom(
static_cast<System::Details::ArrayView<uint8_t>
>(buffer), remoteEP);
841 int32_t optionValue);
894 typedef std::shared_ptr<System::Details::socket_impl>
ImplPtr;
905 std::shared_ptr<System::Details::io_service_impl> io_service;
915 int32_t connectionTimeout;
917 int32_t receiveTimeout;
Represents a segment of the one-dimensional array. Objects of this class should only be allocated usi...
Definition: array_segment.h:63
Interface of indexed container of elements. Objects of this class should only be allocated using Syst...
Definition: ilist.h:19
Defines method that releases resources owned by the current object. Objects of this class should only...
Definition: idisposable.h:30
The Socket class implements the Berkeley sockets interface.
Definition: socket.h:37
int32_t SendTo(System::Details::StackArray< uint8_t, N > &buffer, SocketFlags socketFlags, System::SharedPtr< EndPoint > remoteEP)
Sends the specified data to the specified endpoint.
Definition: socket.h:508
int32_t Receive(System::Details::StackArray< uint8_t, N > &buffer, int32_t size, SocketFlags socketFlags)
Receives data from the socket and writes it to the specified byte array.
Definition: socket.h:550
System::Net::Sockets::SocketType get_SocketType()
Returns the socket type.
int32_t ReceiveMessageFrom(System::Details::StackArray< uint8_t, N > &buffer, int32_t offset, int32_t size, SocketFlags &socketFlags, System::SharedPtr< EndPoint > &remoteEP, IPPacketInformation &ipPacketInformation)
Receives data from the specified endpoint and writes it to the specified byte array.
Definition: socket.h:705
System::ArrayPtr< uint8_t > GetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, int32_t optionLength)
Returns the value that corresponds to the specified option name.
int32_t Send(System::ArrayPtr< uint8_t > buffer)
Sends the specified data to the socket.
void set_SendBufferSize(int32_t value)
Sets the send buffer size.
int32_t ReceiveFrom(System::Details::ArrayView< uint8_t > buffer, System::SharedPtr< EndPoint > &remoteEP)
Receives data from the specified endpoint and writes it to the specified byte array.
int32_t SendTo(System::Details::ArrayView< uint8_t > buffer, SocketFlags socketFlags, System::SharedPtr< EndPoint > remoteEP)
Sends the specified data to the specified endpoint.
int32_t get_SendTimeout()
Gets a period after which a 'Send' call will time out.
void set_SendTimeout(int32_t value)
Sets a period after which a 'Send' call will time out.
int32_t ReceiveFrom(System::ArrayPtr< uint8_t > buffer, SocketFlags socketFlags, System::SharedPtr< EndPoint > &remoteEP)
Receives data from the specified endpoint and writes it to the specified byte array.
void EndConnect(System::SharedPtr< IAsyncResult > asyncResult)
Waits until the specified asynchronous connect operation completes.
void Connect(System::SharedPtr< IPAddress > address, int32_t port)
Establishes a connection to the specified remote endpoint.
int32_t Receive(System::Details::StackArray< uint8_t, N > &buffer)
Receives data from the socket and writes it to the specified byte array.
Definition: socket.h:585
void set_EnableBroadcast(bool value)
Sets a value that indicates if the socket allows broadcast packets.
void Close(int timeout)
Closes the socket connection with the specified timeout to allow queued data to be sent.
bool get_DualMode()
Gets a value indicates if the socket is in the dual-mode.
void set_MulticastLoopback(bool value)
Sets a value that indicates if the socket receives outgoing multicast packets.
int32_t Send(System::Details::ArrayView< uint8_t > buffer, int32_t size, SocketFlags socketFlags)
Sends the specified data to the socket.
int32_t Receive(System::ArrayPtr< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags)
Receives data from the socket and writes it to the specified byte array.
int32_t ReceiveFrom(System::Details::ArrayView< uint8_t > buffer, SocketFlags socketFlags, System::SharedPtr< EndPoint > &remoteEP)
Receives data from the specified endpoint and writes it to the specified byte array.
int32_t SendTo(System::Details::ArrayView< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags, System::SharedPtr< EndPoint > remoteEP)
Sends the specified data to the specified endpoint.
bool get_ExclusiveAddressUse()
Gets a value that indicates if only one process can bind the socket to a port.
static bool get_OSSupportsIPv4()
Returns a value that indicates if the operating system and network adaptors support IPv4.
int32_t Receive(System::ArrayPtr< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags, SocketError &errorCode)
Receives data from the socket and writes it to the specified byte array.
int32_t Send(System::Details::ArrayView< uint8_t > buffer)
Sends the specified data to the socket.
int32_t SendTo(System::Details::StackArray< uint8_t, N > &buffer, int32_t size, SocketFlags socketFlags, System::SharedPtr< EndPoint > remoteEP)
Sends the specified data to the specified endpoint.
Definition: socket.h:482
void set_NoDelay(bool value)
Sets a value that indicates if the socket is using the Nagle algorithm.
int32_t Send(System::ArrayPtr< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags)
Sends the specified data to the socket.
void SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, System::SharedPtr< Object > optionValue)
Sets the specified socket option to the specified value.
int32_t Send(System::SharedPtr< Collections::Generic::IList< ArraySegment< uint8_t > > > buffers, SocketFlags socketFlags, SocketError &errorCode)
Sends the specified data to the socket.
System::SharedPtr< IAsyncResult > BeginSend(System::ArrayPtr< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags, AsyncCallback callback, System::SharedPtr< Object > state)
Initiates an asynchronous send operation.
int32_t Send(System::Details::StackArray< uint8_t, N > &buffer, int32_t offset, int32_t size, SocketFlags socketFlags)
Sends the specified data to the socket.
Definition: socket.h:390
void SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, bool optionValue)
Sets the specified socket option to the specified value.
void set_ReceiveBufferSize(int32_t value)
Sets the receive buffer size.
bool get_EnableBroadcast()
Gets a value that indicates if the socket allows broadcast packets.
int32_t SendTo(System::Details::StackArray< uint8_t, N > &buffer, int32_t offset, int32_t size, SocketFlags socketFlags, System::SharedPtr< EndPoint > remoteEP)
Sends the specified data to the specified endpoint.
Definition: socket.h:453
static bool get_SupportsIPv4()
Returns a value that indicates if the current host supports IPv4.
int32_t Receive(System::Details::StackArray< uint8_t, N > &buffer, SocketFlags socketFlags)
Receives data from the socket and writes it to the specified byte array.
Definition: socket.h:569
void set_DontFragment(bool value)
Sets a value that indicates if the socket allows IP datagrams to be fragmented.
int32_t SendTo(System::ArrayPtr< uint8_t > buffer, SocketFlags socketFlags, System::SharedPtr< EndPoint > remoteEP)
Sends the specified data to the specified endpoint.
int32_t get_ReceiveBufferSize()
Gets the receive buffer size.
int32_t Send(System::Details::StackArray< uint8_t, N > &buffer, int32_t offset, int32_t size, SocketFlags socketFlags, SocketError &errorCode)
Sends the specified data to the socket.
Definition: socket.h:421
System::SharedPtr< IAsyncResult > BeginConnect(System::ArrayPtr< System::SharedPtr< IPAddress > > addresses, int32_t port, AsyncCallback requestCallback, System::SharedPtr< Object > state)
Initiates an asynchronous connect operation.
System::SharedPtr< Socket > Accept()
Creates a new socket for the newly created connection.
void set_ExclusiveAddressUse(bool value)
Sets a value that indicates if only one process can bind the socket to a port.
virtual ~Socket()
Destructs the current instance.
int32_t ReceiveFrom(System::ArrayPtr< uint8_t > buffer, System::SharedPtr< EndPoint > &remoteEP)
Receives data from the specified endpoint and writes it to the specified byte array.
void set_LingerState(System::SharedPtr< LingerOption > value)
Sets a value that indicates if the socket will delay closing in an attempt to send all pending data.
System::Net::Sockets::AddressFamily get_AddressFamily()
Returns the address family.
bool get_Blocking()
Gets a value that indicates if the socket is in the blocking mode.
int32_t Send(System::SharedPtr< Collections::Generic::IList< ArraySegment< uint8_t > > > buffers, SocketFlags socketFlags)
Sends the specified data to the socket.
int32_t Receive(System::Details::ArrayView< uint8_t > buffer, int32_t size, SocketFlags socketFlags)
Receives data from the socket and writes it to the specified byte array.
int32_t get_SendBufferSize()
Gets the send buffer size.
int32_t Receive(System::ArrayPtr< uint8_t > buffer, int32_t size, SocketFlags socketFlags)
Receives data from the socket and writes it to the specified byte array.
int32_t ReceiveFrom(System::Details::StackArray< uint8_t, N > &buffer, int32_t offset, int32_t size, SocketFlags socketFlags, System::SharedPtr< EndPoint > &remoteEP)
Receives data from the specified endpoint and writes it to the specified byte array.
Definition: socket.h:741
int32_t ReceiveMessageFrom(System::ArrayPtr< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags &socketFlags, System::SharedPtr< EndPoint > &remoteEP, IPPacketInformation &ipPacketInformation)
Receives data from the specified endpoint and writes it to the specified byte array.
int32_t Send(System::Details::StackArray< uint8_t, N > &buffer, int32_t size, SocketFlags socketFlags)
Sends the specified data to the socket.
Definition: socket.h:308
int32_t Receive(System::ArrayPtr< uint8_t > buffer)
Receives data from the socket and writes it to the specified byte array.
static bool get_OSSupportsIPv6()
Returns a value that indicates if the operating system and network adaptors support IPv6.
System::SharedPtr< Object > GetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName)
Returns the value that corresponds to the specified option name.
void set_DualMode(bool value)
Sets a value indicates if the socket is in the dual-mode.
int32_t Receive(System::ArrayPtr< uint8_t > buffer, SocketFlags socketFlags)
Receives data from the socket and writes it to the specified byte array.
void Listen(int32_t backlog)
Changes the socket state to 'listen'.
int32_t Send(System::Details::StackArray< uint8_t, N > &buffer)
Sends the specified data to the socket.
Definition: socket.h:345
int32_t Send(System::SharedPtr< Collections::Generic::IList< ArraySegment< uint8_t > > > buffers)
Sends the specified data to the socket.
int32_t SendTo(System::Details::ArrayView< uint8_t > buffer, int32_t size, SocketFlags socketFlags, System::SharedPtr< EndPoint > remoteEP)
Sends the specified data to the specified endpoint.
bool get_MulticastLoopback()
Gets a value that indicates if the socket receives outgoing multicast packets.
int32_t EndSend(System::SharedPtr< IAsyncResult > asyncResult)
Waits until the specified asynchronous send operation completes.
int32_t Receive(System::Details::ArrayView< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags)
Receives data from the socket and writes it to the specified byte array.
int32_t Receive(System::Details::ArrayView< uint8_t > buffer, SocketFlags socketFlags)
Receives data from the socket and writes it to the specified byte array.
int32_t Receive(System::Details::ArrayView< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags, SocketError &errorCode)
Receives data from the socket and writes it to the specified byte array.
int32_t Receive(System::Details::StackArray< uint8_t, N > &buffer, int32_t offset, int32_t size, SocketFlags socketFlags)
Receives data from the socket and writes it to the specified byte array.
Definition: socket.h:615
ImplPtr GetImpl() const
Returns a pointer to implementation.
void Bind(System::SharedPtr< EndPoint > localEP)
Binds the socket with to the specified local endpoint.
int32_t ReceiveFrom(System::Details::ArrayView< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags, System::SharedPtr< EndPoint > &remoteEP)
Receives data from the specified endpoint and writes it to the specified byte array.
System::SharedPtr< EndPoint > get_RemoteEndPoint()
Returns the remote endpoint.
int32_t SendTo(System::ArrayPtr< uint8_t > buffer, System::SharedPtr< EndPoint > remoteEP)
Sends the specified data to the specified endpoint.
int32_t Receive(System::Details::ArrayView< uint8_t > buffer)
Receives data from the socket and writes it to the specified byte array.
int32_t SendTo(System::Details::ArrayView< uint8_t > buffer, System::SharedPtr< EndPoint > remoteEP)
Sends the specified data to the specified endpoint.
System::Net::Sockets::ProtocolType get_ProtocolType()
Returns the protocol type.
int32_t IOControl(int32_t ioControlCode, System::ArrayPtr< uint8_t > optionInValue, System::ArrayPtr< uint8_t > optionOutValue)
Sets low-level operating modes for the socket.
int32_t Receive(System::SharedPtr< Collections::Generic::IList< ArraySegment< uint8_t > > > buffers)
Receives data from the socket and writes it to the specified byte arrays.
int32_t ReceiveFrom(System::Details::StackArray< uint8_t, N > &buffer, System::SharedPtr< EndPoint > &remoteEP)
Receives data from the specified endpoint and writes it to the specified byte array.
Definition: socket.h:818
void Close()
Closes the socket connection.
void set_Ttl(int16_t value)
Sets the TTL value.
int32_t ReceiveFrom(System::ArrayPtr< uint8_t > buffer, int32_t size, SocketFlags socketFlags, System::SharedPtr< EndPoint > &remoteEP)
Receives data from the specified endpoint and writes it to the specified byte array.
int32_t SendTo(System::ArrayPtr< uint8_t > buffer, int32_t size, SocketFlags socketFlags, System::SharedPtr< EndPoint > remoteEP)
Sends the specified data to the specified endpoint.
void Connect(String host, int32_t port)
Establishes a connection to the specified remote endpoint.
int32_t get_ReceiveTimeout()
Gets a period after which a 'Receive' call will time out.
System::SharedPtr< IAsyncResult > BeginConnect(System::SharedPtr< IPAddress > address, int32_t port, AsyncCallback requestCallback, System::SharedPtr< Object > state)
Initiates an asynchronous connect operation.
System::SharedPtr< IAsyncResult > BeginReceive(System::ArrayPtr< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags, AsyncCallback callback, System::SharedPtr< Object > state)
Initiates an asynchronous write operation.
int32_t Send(System::Details::ArrayView< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags)
Sends the specified data to the socket.
int32_t Send(System::Details::StackArray< uint8_t, N > &buffer, SocketFlags socketFlags)
Sends the specified data to the socket.
Definition: socket.h:328
int32_t SendTo(System::Details::StackArray< uint8_t, N > &buffer, System::SharedPtr< EndPoint > remoteEP)
Sends the specified data to the specified endpoint.
Definition: socket.h:528
int32_t get_Available()
Gets the number of bytes received from the network and available for reading.
int32_t ReceiveFrom(System::Details::StackArray< uint8_t, N > &buffer, int32_t size, SocketFlags socketFlags, System::SharedPtr< EndPoint > &remoteEP)
Receives data from the specified endpoint and writes it to the specified byte array.
Definition: socket.h:773
int32_t Receive(System::SharedPtr< Collections::Generic::IList< ArraySegment< uint8_t > > > buffers, SocketFlags socketFlags, SocketError &errorCode)
Receives data from the socket and writes it to the specified byte arrays.
int32_t Receive(System::Details::StackArray< uint8_t, N > &buffer, int32_t offset, int32_t size, SocketFlags socketFlags, SocketError &errorCode)
Receives data from the socket and writes it to the specified byte array.
Definition: socket.h:649
void SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, System::ArrayPtr< uint8_t > optionValue)
Sets the specified socket option to the specified value.
System::SharedPtr< LingerOption > get_LingerState()
Gets a value that indicates if the socket will delay closing in an attempt to send all pending data.
void GetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, System::ArrayPtr< uint8_t > optionValue)
Gets the value that corresponds to the specified option name.
Socket(System::Net::Sockets::AddressFamily addressFamily, System::Net::Sockets::SocketType socketType, System::Net::Sockets::ProtocolType protocolType)
Constructs a new instance.
int32_t EndReceive(System::SharedPtr< IAsyncResult > asyncResult, SocketError &errorCode)
Waits until the specified asynchronous receive operation completes.
bool get_Connected()
Returns a value that indicates if the socket is connected to the remote host.
void Connect(System::SharedPtr< EndPoint > remoteEP)
Establishes a connection to the specified remote endpoint.
int32_t IOControl(IOControlCode ioControlCode, System::ArrayPtr< uint8_t > optionInValue, System::ArrayPtr< uint8_t > optionOutValue)
Sets low-level operating modes for the socket.
int32_t ReceiveFrom(System::Details::ArrayView< uint8_t > buffer, int32_t size, SocketFlags socketFlags, System::SharedPtr< EndPoint > &remoteEP)
Receives data from the specified endpoint and writes it to the specified byte array.
bool get_DontFragment()
Gets a value that indicates if the socket allows IP datagrams to be fragmented.
System::SharedPtr< IAsyncResult > BeginConnect(System::SharedPtr< EndPoint > remoteEP, AsyncCallback callback, System::SharedPtr< Object > state)
Initiates an asynchronous connect operation.
int32_t Send(System::Details::ArrayView< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags, SocketError &errorCode)
Sends the specified data to the socket.
bool get_IsBound()
Returns a value that indicates if the socket is bound to a specific local port.
int32_t ReceiveFrom(System::ArrayPtr< uint8_t > buffer, SocketFlags socketFlags, System::SharedPtr< EndPoint > &remoteEP)
Receives data from the specified endpoint and writes it to the specified byte array.
Definition: socket.h:798
int16_t get_Ttl()
Gets the TTL value.
int32_t Send(System::ArrayPtr< uint8_t > buffer, SocketFlags socketFlags)
Sends the specified data to the socket.
bool Poll(int32_t microSeconds, SelectMode mode)
Returns the status of the socket based on the specified polling mode.
int32_t ReceiveMessageFrom(System::Details::ArrayView< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags &socketFlags, System::SharedPtr< EndPoint > &remoteEP, IPPacketInformation &ipPacketInformation)
Receives data from the specified endpoint and writes it to the specified byte array.
int32_t Send(System::Details::ArrayView< uint8_t > buffer, SocketFlags socketFlags)
Sends the specified data to the socket.
int32_t Send(System::ArrayPtr< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags, SocketError &errorCode)
Sends the specified data to the socket.
void set_Blocking(bool value)
Sets a value that indicates if the socket is in the blocking mode.
int32_t SendTo(System::ArrayPtr< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags, System::SharedPtr< EndPoint > remoteEP)
Sends the specified data to the specified endpoint.
int32_t ReceiveFrom(System::ArrayPtr< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags, System::SharedPtr< EndPoint > &remoteEP)
Receives data from the specified endpoint and writes it to the specified byte array.
void Dispose() override
Does nothing.
int32_t Send(System::ArrayPtr< uint8_t > buffer, int32_t size, SocketFlags socketFlags)
Sends the specified data to the socket.
System::SharedPtr< IAsyncResult > BeginConnect(String host, int32_t port, AsyncCallback requestCallback, System::SharedPtr< Object > state)
Initiates an asynchronous connect operation.
void set_ConnectionTimeout(int32_t value)
Sets the connection timeout.
int32_t EndSend(System::SharedPtr< IAsyncResult > asyncResult, SocketError &errorCode)
Waits until the specified asynchronous send operation completes.
void Connect(System::ArrayPtr< System::SharedPtr< IPAddress > > addresses, int32_t port)
Establishes a connection to the specified remote endpoint.
int32_t EndReceive(System::SharedPtr< IAsyncResult > asyncResult)
Waits until the specified asynchronous receive operation completes.
std::shared_ptr< System::Details::socket_impl > ImplPtr
The socket implementation.
Definition: socket.h:894
void Shutdown(SocketShutdown how)
Disables the send and receive operations of the socket.
bool get_NoDelay()
Gets a value that indicates if the socket is using the Nagle algorithm.
void set_ReceiveTimeout(int32_t value)
Sets a period after which a 'Receive' call will time out.
void SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, int32_t optionValue)
Sets the specified socket option to the specified value.
int32_t Receive(System::SharedPtr< Collections::Generic::IList< ArraySegment< uint8_t > > > buffers, SocketFlags socketFlags)
Receives data from the socket and writes it to the specified byte arrays.
Socket(System::Net::Sockets::SocketType socketType, System::Net::Sockets::ProtocolType protocolType)
Constructs a new instance.
System::SharedPtr< EndPoint > get_LocalEndPoint()
Returns the local endpoint.
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
SelectMode
Specifies the mode for polling the status of the socket.
Definition: select_mode.h:10
SocketShutdown
Defines constants used by the Socket.Shutdown method.
Definition: socket_shutdown.h:10
@ Receive
Disables the socket for receiving.
@ Send
Disables the socket for sending.
IOControlCode
Enumerates the IO control codes.
Definition: io_control_code.h:12
AddressFamily
Enumerates the address families.
Definition: address_family.h:12
SocketOptionLevel
Defines socket option levels for the 'Socket' class.
Definition: socket_option_level.h:12
SocketError
Enumerates the socket error types.
Definition: socket_error.h:13
ProtocolType
Enumerates the protocol types.
Definition: protocol_type.h:12
SocketType
Enumerates the socket types.
Definition: socket_type.h:12
SocketOptionName
Defines socket option names for the Socket class.
Definition: socket_option_name.h:12
SocketFlags
Provides constant values for the socket messages.
Definition: socket_flags.h:12
Definition: db_command.h:9
System::MulticastDelegate< void(SharedPtr< IAsyncResult >)> AsyncCallback
A delegate type that represents a method to be called when asynchronous operation completes.
Definition: async_callback.h:13