Asposecpplib
System::Net::Sockets::Socket Class Reference

The Socket class implements the Berkeley sockets interface. More...

Inherits System::IDisposable.

Public Types

typedef std::shared_ptr< System::Details::socket_impl > ImplPtr
 The socket implementation. More...
 
- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 

Public Member Functions

int32_t get_Available ()
 Gets the number of bytes received from the network and available for reading. More...
 
System::SharedPtr< EndPointget_LocalEndPoint ()
 Returns the local endpoint. More...
 
System::SharedPtr< EndPointget_RemoteEndPoint ()
 Returns the remote endpoint. More...
 
bool get_Blocking ()
 Gets a value that indicates if the socket is in the blocking mode. More...
 
void set_Blocking (bool value)
 Sets a value that indicates if the socket is in the blocking mode. More...
 
bool get_Connected ()
 Returns a value that indicates if the socket is connected to the remote host. More...
 
System::Net::Sockets::AddressFamily get_AddressFamily ()
 Returns the address family. More...
 
System::Net::Sockets::SocketType get_SocketType ()
 Returns the socket type. More...
 
System::Net::Sockets::ProtocolType get_ProtocolType ()
 Returns the protocol type. More...
 
bool get_IsBound ()
 Returns a value that indicates if the socket is bound to a specific local port. More...
 
bool get_ExclusiveAddressUse ()
 Gets a value that indicates if only one process can bind the socket to a port. More...
 
void set_ExclusiveAddressUse (bool value)
 Sets a value that indicates if only one process can bind the socket to a port. More...
 
int32_t get_ReceiveBufferSize ()
 Gets the receive buffer size. More...
 
void set_ReceiveBufferSize (int32_t value)
 Sets the receive buffer size. More...
 
int32_t get_SendBufferSize ()
 Gets the send buffer size. More...
 
void set_SendBufferSize (int32_t value)
 Sets the send buffer size. More...
 
int32_t get_ReceiveTimeout ()
 Gets a period after which a 'Receive' call will time out. More...
 
void set_ReceiveTimeout (int32_t value)
 Sets a period after which a 'Receive' call will time out. More...
 
int32_t get_SendTimeout ()
 Gets a period after which a 'Send' call will time out. More...
 
void set_SendTimeout (int32_t value)
 Sets a period after which a 'Send' call will time out. More...
 
System::SharedPtr< LingerOptionget_LingerState ()
 Gets a value that indicates if the socket will delay closing in an attempt to send all pending data. More...
 
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. More...
 
bool get_NoDelay ()
 Gets a value that indicates if the socket is using the Nagle algorithm. More...
 
void set_NoDelay (bool value)
 Sets a value that indicates if the socket is using the Nagle algorithm. More...
 
int16_t get_Ttl ()
 Gets the TTL value. More...
 
void set_Ttl (int16_t value)
 Sets the TTL value. More...
 
bool get_DontFragment ()
 Gets a value that indicates if the socket allows IP datagrams to be fragmented. More...
 
void set_DontFragment (bool value)
 Sets a value that indicates if the socket allows IP datagrams to be fragmented. More...
 
bool get_MulticastLoopback ()
 Gets a value that indicates if the socket receives outgoing multicast packets. More...
 
void set_MulticastLoopback (bool value)
 Sets a value that indicates if the socket receives outgoing multicast packets. More...
 
bool get_EnableBroadcast ()
 Gets a value that indicates if the socket allows broadcast packets. More...
 
void set_EnableBroadcast (bool value)
 Sets a value that indicates if the socket allows broadcast packets. More...
 
bool get_DualMode ()
 Gets a value indicates if the socket is in the dual-mode. More...
 
void set_DualMode (bool value)
 Sets a value indicates if the socket is in the dual-mode. More...
 
 Socket (System::Net::Sockets::SocketType socketType, System::Net::Sockets::ProtocolType protocolType)
 Constructs a new instance. More...
 
 Socket (System::Net::Sockets::AddressFamily addressFamily, System::Net::Sockets::SocketType socketType, System::Net::Sockets::ProtocolType protocolType)
 Constructs a new instance. More...
 
System::SharedPtr< IAsyncResultBeginSend (System::ArrayPtr< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags, AsyncCallback callback, System::SharedPtr< Object > state)
 Initiates an asynchronous send operation. More...
 
int32_t EndSend (System::SharedPtr< IAsyncResult > asyncResult)
 Waits until the specified asynchronous send operation completes. More...
 
int32_t EndSend (System::SharedPtr< IAsyncResult > asyncResult, SocketError &errorCode)
 Waits until the specified asynchronous send operation completes. More...
 
System::SharedPtr< IAsyncResultBeginReceive (System::ArrayPtr< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags, AsyncCallback callback, System::SharedPtr< Object > state)
 Initiates an asynchronous write operation. More...
 
int32_t EndReceive (System::SharedPtr< IAsyncResult > asyncResult)
 Waits until the specified asynchronous receive operation completes. More...
 
int32_t EndReceive (System::SharedPtr< IAsyncResult > asyncResult, SocketError &errorCode)
 Waits until the specified asynchronous receive operation completes. More...
 
void Bind (System::SharedPtr< EndPoint > localEP)
 Binds the socket with to the specified local endpoint. More...
 
void Connect (System::SharedPtr< EndPoint > remoteEP)
 Establishes a connection to the specified remote endpoint. More...
 
void Connect (System::SharedPtr< IPAddress > address, int32_t port)
 Establishes a connection to the specified remote endpoint. More...
 
void Connect (String host, int32_t port)
 Establishes a connection to the specified remote endpoint. More...
 
void Connect (System::ArrayPtr< System::SharedPtr< IPAddress >> addresses, int32_t port)
 Establishes a connection to the specified remote endpoint. More...
 
System::SharedPtr< IAsyncResultBeginConnect (System::SharedPtr< EndPoint > remoteEP, AsyncCallback callback, System::SharedPtr< Object > state)
 Initiates an asynchronous connect operation. More...
 
System::SharedPtr< IAsyncResultBeginConnect (String host, int32_t port, AsyncCallback requestCallback, System::SharedPtr< Object > state)
 Initiates an asynchronous connect operation. More...
 
System::SharedPtr< IAsyncResultBeginConnect (System::SharedPtr< IPAddress > address, int32_t port, AsyncCallback requestCallback, System::SharedPtr< Object > state)
 Initiates an asynchronous connect operation. More...
 
System::SharedPtr< IAsyncResultBeginConnect (System::ArrayPtr< System::SharedPtr< IPAddress >> addresses, int32_t port, AsyncCallback requestCallback, System::SharedPtr< Object > state)
 Initiates an asynchronous connect operation. More...
 
void Close ()
 Closes the socket connection. More...
 
void Close (int timeout)
 Closes the socket connection with the specified timeout to allow queued data to be sent. More...
 
void EndConnect (System::SharedPtr< IAsyncResult > asyncResult)
 Waits until the specified asynchronous connect operation completes. More...
 
void Listen (int32_t backlog)
 Changes the socket state to 'listen'. More...
 
System::SharedPtr< SocketAccept ()
 Creates a new socket for the newly created connection. More...
 
int32_t Send (System::ArrayPtr< uint8_t > buffer, int32_t size, SocketFlags socketFlags)
 Sends the specified data to the socket. More...
 
int32_t Send (System::ArrayPtr< uint8_t > buffer, SocketFlags socketFlags)
 Sends the specified data to the socket. More...
 
int32_t Send (System::ArrayPtr< uint8_t > buffer)
 Sends the specified data to the socket. More...
 
int32_t Send (System::SharedPtr< Collections::Generic::IList< ArraySegment< uint8_t >>> buffers)
 Sends the specified data to the socket. More...
 
int32_t Send (System::SharedPtr< Collections::Generic::IList< ArraySegment< uint8_t >>> buffers, SocketFlags socketFlags)
 Sends the specified data to the socket. More...
 
int32_t Send (System::SharedPtr< Collections::Generic::IList< ArraySegment< uint8_t >>> buffers, SocketFlags socketFlags, SocketError &errorCode)
 Sends the specified data to the socket. More...
 
int32_t Send (System::ArrayPtr< uint8_t > buffer, int32_t offset, int32_t size, SocketFlags socketFlags)
 Sends the specified data to the socket. More...
 
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. More...
 
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. More...
 
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. More...
 
int32_t SendTo (System::ArrayPtr< uint8_t > buffer, SocketFlags socketFlags, System::SharedPtr< EndPoint > remoteEP)
 Sends the specified data to the specified endpoint. More...
 
int32_t SendTo (System::ArrayPtr< uint8_t > buffer, System::SharedPtr< EndPoint > remoteEP)
 Sends the specified data to the specified endpoint. More...
 
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. More...
 
int32_t Receive (System::ArrayPtr< uint8_t > buffer, SocketFlags socketFlags)
 Receives data from the socket and writes it to the specified byte array. More...
 
int32_t Receive (System::ArrayPtr< uint8_t > buffer)
 Receives data from the socket and writes it to the specified byte array. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
int32_t IOControl (int32_t ioControlCode, System::ArrayPtr< uint8_t > optionInValue, System::ArrayPtr< uint8_t > optionOutValue)
 Sets low-level operating modes for the socket. More...
 
int32_t IOControl (IOControlCode ioControlCode, System::ArrayPtr< uint8_t > optionInValue, System::ArrayPtr< uint8_t > optionOutValue)
 Sets low-level operating modes for the socket. More...
 
void SetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, int32_t optionValue)
 Sets the specified socket option to the specified value. More...
 
void SetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, System::ArrayPtr< uint8_t > optionValue)
 Sets the specified socket option to the specified value. More...
 
void SetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, bool optionValue)
 Sets the specified socket option to the specified value. More...
 
void SetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, System::SharedPtr< Object > optionValue)
 Sets the specified socket option to the specified value. More...
 
System::SharedPtr< ObjectGetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName)
 Returns the value that corresponds to the specified option name. More...
 
void GetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, System::ArrayPtr< uint8_t > optionValue)
 Gets the value that corresponds to the specified option name. More...
 
System::ArrayPtr< uint8_t > GetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, int32_t optionLength)
 Returns the value that corresponds to the specified option name. More...
 
bool Poll (int32_t microSeconds, SelectMode mode)
 Returns the status of the socket based on the specified polling mode. More...
 
void Shutdown (SocketShutdown how)
 Disables the send and receive operations of the socket. More...
 
void Dispose () override
 Does nothing. More...
 
virtual ~Socket ()
 Destructs the current instance. More...
 
ImplPtr GetImpl () const
 Returns a pointer to implementation. More...
 
void set_ConnectionTimeout (int32_t value)
 Sets the connection timeout. More...
 
- Public Member Functions inherited from System::Object
 Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ~Object ()
 Destroys object. Frees all internal data structures. More...
 
 Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Objectoperator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
ObjectSharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared reference counter. More...
 
void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual bool Equals (ptr obj)
 Compares objects using C# Object.Equals semantics. More...
 
virtual int32_t GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual String ToString () const
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual void SetTemplateWeakPtr (uint32_t argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 
virtual bool FastCast (const Details::FastRttiBase &helper, void **out_ptr) const
 For internal purposes only. More...
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 Specialization of Object::ReferenceEquals for case of string and nullptr. More...
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 Specialization of Object::ReferenceEquals for case of strings. More...
 

Static Public Member Functions

static bool get_SupportsIPv4 ()
 Returns a value that indicates if the current host supports IPv4. More...
 
static bool get_OSSupportsIPv4 ()
 Returns a value that indicates if the operating system and network adaptors support IPv4. More...
 
static bool get_OSSupportsIPv6 ()
 Returns a value that indicates if the operating system and network adaptors support IPv6. More...
 
- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfoType ()
 Implements C# typeof(System.Object) construct. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More...
 
template<>
bool Equals (double const &objA, double const &objB)
 Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More...
 

Detailed Description

The Socket class implements the Berkeley sockets interface.

Member Typedef Documentation

◆ ImplPtr

typedef std::shared_ptr<System::Details::socket_impl> System::Net::Sockets::Socket::ImplPtr

The socket implementation.

Constructor & Destructor Documentation

◆ Socket() [1/2]

System::Net::Sockets::Socket::Socket ( System::Net::Sockets::SocketType  socketType,
System::Net::Sockets::ProtocolType  protocolType 
)

Constructs a new instance.

Parameters
socketTypeThe socket type.
protocolTypeThe protocol type.

◆ Socket() [2/2]

System::Net::Sockets::Socket::Socket ( System::Net::Sockets::AddressFamily  addressFamily,
System::Net::Sockets::SocketType  socketType,
System::Net::Sockets::ProtocolType  protocolType 
)

Constructs a new instance.

Parameters
addressFamilyThe address family.
socketTypeThe socket type.
protocolTypeThe protocol type.

◆ ~Socket()

virtual System::Net::Sockets::Socket::~Socket ( )
virtual

Destructs the current instance.

Member Function Documentation

◆ Accept()

System::SharedPtr<Socket> System::Net::Sockets::Socket::Accept ( )

Creates a new socket for the newly created connection.

Returns
A new socket for the newly created connection.

◆ BeginConnect() [1/4]

System::SharedPtr<IAsyncResult> System::Net::Sockets::Socket::BeginConnect ( String  host,
int32_t  port,
AsyncCallback  requestCallback,
System::SharedPtr< Object state 
)

Initiates an asynchronous connect operation.

Parameters
hostThe remote host name.
portThe port number of the remote host.
requestCallbackA callback that will be called when the operation completes.
stateUser-provided data used to uniquely identify each asynchronous connect operation.
Returns
An IAsyncResult object representing the initiated asynchronous connect operation.

◆ BeginConnect() [2/4]

System::SharedPtr<IAsyncResult> System::Net::Sockets::Socket::BeginConnect ( System::ArrayPtr< System::SharedPtr< IPAddress >>  addresses,
int32_t  port,
AsyncCallback  requestCallback,
System::SharedPtr< Object state 
)

Initiates an asynchronous connect operation.

Parameters
addressesThe IP addresses of the remote host.
portThe port number of the remote host.
requestCallbackA callback that will be called when the operation completes.
stateUser-provided data used to uniquely identify each asynchronous connect operation.
Returns
An IAsyncResult object representing the initiated asynchronous connect operation.

◆ BeginConnect() [3/4]

System::SharedPtr<IAsyncResult> System::Net::Sockets::Socket::BeginConnect ( System::SharedPtr< EndPoint remoteEP,
AsyncCallback  callback,
System::SharedPtr< Object state 
)

Initiates an asynchronous connect operation.

Parameters
remoteEPThe remote endpoint.
callbackA callback that will be called when the operation completes.
stateUser-provided data used to uniquely identify each asynchronous connect operation.
Returns
An IAsyncResult object representing the initiated asynchronous connect operation.

◆ BeginConnect() [4/4]

System::SharedPtr<IAsyncResult> System::Net::Sockets::Socket::BeginConnect ( System::SharedPtr< IPAddress address,
int32_t  port,
AsyncCallback  requestCallback,
System::SharedPtr< Object state 
)

Initiates an asynchronous connect operation.

Parameters
addressThe remote host IP address.
portThe port number of the remote host.
requestCallbackA callback that will be called when the operation completes.
stateUser-provided data used to uniquely identify each asynchronous connect operation.
Returns
An IAsyncResult object representing the initiated asynchronous connect operation.

◆ BeginReceive()

System::SharedPtr<IAsyncResult> System::Net::Sockets::Socket::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.

Parameters
bufferA buffer where the received data will be assigned.
offsetThe offset in bytes in the specified array.
sizeThe number of bytes in the specified array starting from the 'offset' parameter.
socketFlagsThe receive behaviour.
callbackA callback that will be called when the operation completes.
stateUser-provided data used to uniquely identify each asynchronous receive operation.
Returns
An IAsyncResult object representing the initiated asynchronous receive operation.

◆ BeginSend()

System::SharedPtr<IAsyncResult> System::Net::Sockets::Socket::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.

Parameters
bufferA buffer to read data from.
offsetThe offset in bytes in the specified array.
sizeThe number of bytes in the specified array starting from the 'offset' parameter.
socketFlagsThe send behaviour.
callbackA callback that will be called when the operation completes.
stateUser-provided data used to uniquely identify each asynchronous send operation.
Returns
An IAsyncResult object representing the initiated asynchronous send operation.

◆ Bind()

void System::Net::Sockets::Socket::Bind ( System::SharedPtr< EndPoint localEP)

Binds the socket with to the specified local endpoint.

Parameters
localEPThe local endpoint to which the socket is bound.

◆ Close() [1/2]

void System::Net::Sockets::Socket::Close ( )

Closes the socket connection.

◆ Close() [2/2]

void System::Net::Sockets::Socket::Close ( int  timeout)

Closes the socket connection with the specified timeout to allow queued data to be sent.

Parameters
timeoutA number of milliseconds to wait.

◆ Connect() [1/4]

void System::Net::Sockets::Socket::Connect ( String  host,
int32_t  port 
)

Establishes a connection to the specified remote endpoint.

Parameters
hostThe remote host name.
portThe port number of the remote host.

◆ Connect() [2/4]

void System::Net::Sockets::Socket::Connect ( System::ArrayPtr< System::SharedPtr< IPAddress >>  addresses,
int32_t  port 
)

Establishes a connection to the specified remote endpoint.

Parameters
addressesThe IP addresses of the remote host.
portThe port number of the remote host.

◆ Connect() [3/4]

void System::Net::Sockets::Socket::Connect ( System::SharedPtr< EndPoint remoteEP)

Establishes a connection to the specified remote endpoint.

Parameters
remoteEPThe remote endpoint.

◆ Connect() [4/4]

void System::Net::Sockets::Socket::Connect ( System::SharedPtr< IPAddress address,
int32_t  port 
)

Establishes a connection to the specified remote endpoint.

Parameters
addressThe remote host IP address.
portThe port number of the remote host.

◆ Dispose()

void System::Net::Sockets::Socket::Dispose ( )
overridevirtual

Does nothing.

Reimplemented from System::IDisposable.

◆ EndConnect()

void System::Net::Sockets::Socket::EndConnect ( System::SharedPtr< IAsyncResult asyncResult)

Waits until the specified asynchronous connect operation completes.

Parameters
asyncResultAn IAsyncResult object that represents an asynchronous connect operation.

◆ EndReceive() [1/2]

int32_t System::Net::Sockets::Socket::EndReceive ( System::SharedPtr< IAsyncResult asyncResult)

Waits until the specified asynchronous receive operation completes.

Parameters
asyncResultAn IAsyncResult object that represents an asynchronous receive operation.
Returns
The number of bytes that are received.

◆ EndReceive() [2/2]

int32_t System::Net::Sockets::Socket::EndReceive ( System::SharedPtr< IAsyncResult asyncResult,
SocketError errorCode 
)

Waits until the specified asynchronous receive operation completes.

Parameters
asyncResultAn IAsyncResult object that represents an asynchronous receive operation.
errorCodeThe output parameter where the error code will be assigned when the receive operation fails.
Returns
The number of received bytes.

◆ EndSend() [1/2]

int32_t System::Net::Sockets::Socket::EndSend ( System::SharedPtr< IAsyncResult asyncResult)

Waits until the specified asynchronous send operation completes.

Parameters
asyncResultAn IAsyncResult object that represents an asynchronous send operation.
Returns
The number of sent bytes.

◆ EndSend() [2/2]

int32_t System::Net::Sockets::Socket::EndSend ( System::SharedPtr< IAsyncResult asyncResult,
SocketError errorCode 
)

Waits until the specified asynchronous send operation completes.

Parameters
asyncResultAn IAsyncResult object that represents an asynchronous send operation.
errorCodeThe output parameter where the error code will be assigned when the send operation fails.
Returns
The number of sent bytes.

◆ get_AddressFamily()

System::Net::Sockets::AddressFamily System::Net::Sockets::Socket::get_AddressFamily ( )

Returns the address family.

Returns
The address family.

◆ get_Available()

int32_t System::Net::Sockets::Socket::get_Available ( )

Gets the number of bytes received from the network and available for reading.

Returns
The number of bytes received from the network and available for reading.

◆ get_Blocking()

bool System::Net::Sockets::Socket::get_Blocking ( )

Gets a value that indicates if the socket is in the blocking mode.

Returns
A value that indicates if the socket is in the blocking mode.

◆ get_Connected()

bool System::Net::Sockets::Socket::get_Connected ( )

Returns a value that indicates if the socket is connected to the remote host.

Returns
A value that indicates if the socket is connected to the remote host.

◆ get_DontFragment()

bool System::Net::Sockets::Socket::get_DontFragment ( )

Gets a value that indicates if the socket allows IP datagrams to be fragmented.

Returns
A value that indicates if the socket allows IP datagrams to be fragmented.

◆ get_DualMode()

bool System::Net::Sockets::Socket::get_DualMode ( )

Gets a value indicates if the socket is in the dual-mode.

Returns
A value indicates if the socket is in the dual-mode.

◆ get_EnableBroadcast()

bool System::Net::Sockets::Socket::get_EnableBroadcast ( )

Gets a value that indicates if the socket allows broadcast packets.

Returns
A value that indicates if the socket allows broadcast packets.

◆ get_ExclusiveAddressUse()

bool System::Net::Sockets::Socket::get_ExclusiveAddressUse ( )

Gets a value that indicates if only one process can bind the socket to a port.

Returns
A value that indicates if only one process can bind the socket to a port.

◆ get_IsBound()

bool System::Net::Sockets::Socket::get_IsBound ( )

Returns a value that indicates if the socket is bound to a specific local port.

Returns
A value that indicates if the socket is bound to a specific local port.

◆ get_LingerState()

System::SharedPtr<LingerOption> System::Net::Sockets::Socket::get_LingerState ( )

Gets a value that indicates if the socket will delay closing in an attempt to send all pending data.

Returns
A value that indicates if the socket will delay closing in an attempt to send all pending data.

◆ get_LocalEndPoint()

System::SharedPtr<EndPoint> System::Net::Sockets::Socket::get_LocalEndPoint ( )

Returns the local endpoint.

Returns
The local endpoint.

◆ get_MulticastLoopback()

bool System::Net::Sockets::Socket::get_MulticastLoopback ( )

Gets a value that indicates if the socket receives outgoing multicast packets.

Returns
A value that indicates if the socket receives outgoing multicast packets.

◆ get_NoDelay()

bool System::Net::Sockets::Socket::get_NoDelay ( )

Gets a value that indicates if the socket is using the Nagle algorithm.

Returns
A value that indicates if the socket is using the Nagle algorithm.

◆ get_OSSupportsIPv4()

static bool System::Net::Sockets::Socket::get_OSSupportsIPv4 ( )
static

Returns a value that indicates if the operating system and network adaptors support IPv4.

Returns
A value that indicates if the operating system and network adaptors support IPv4.

◆ get_OSSupportsIPv6()

static bool System::Net::Sockets::Socket::get_OSSupportsIPv6 ( )
static

Returns a value that indicates if the operating system and network adaptors support IPv6.

Returns
A value that indicates if the operating system and network adaptors support IPv6.

◆ get_ProtocolType()

System::Net::Sockets::ProtocolType System::Net::Sockets::Socket::get_ProtocolType ( )

Returns the protocol type.

Returns
The protocol type.

◆ get_ReceiveBufferSize()

int32_t System::Net::Sockets::Socket::get_ReceiveBufferSize ( )

Gets the receive buffer size.

Returns
The receive buffer size.

◆ get_ReceiveTimeout()

int32_t System::Net::Sockets::Socket::get_ReceiveTimeout ( )

Gets a period after which a 'Receive' call will time out.

Returns
A period after which a 'Receive' call will time out.

◆ get_RemoteEndPoint()

System::SharedPtr<EndPoint> System::Net::Sockets::Socket::get_RemoteEndPoint ( )

Returns the remote endpoint.

Returns
The remote endpoint.

◆ get_SendBufferSize()

int32_t System::Net::Sockets::Socket::get_SendBufferSize ( )

Gets the send buffer size.

Returns
The send buffer size.

◆ get_SendTimeout()

int32_t System::Net::Sockets::Socket::get_SendTimeout ( )

Gets a period after which a 'Send' call will time out.

Returns
A period after which a 'Send' call will time out.

◆ get_SocketType()

System::Net::Sockets::SocketType System::Net::Sockets::Socket::get_SocketType ( )

Returns the socket type.

Returns
The socket type.

◆ get_SupportsIPv4()

static bool System::Net::Sockets::Socket::get_SupportsIPv4 ( )
static

Returns a value that indicates if the current host supports IPv4.

Returns
A value that indicates if the current host supports IPv4.

◆ get_Ttl()

int16_t System::Net::Sockets::Socket::get_Ttl ( )

Gets the TTL value.

Returns
The TTL value.

◆ GetImpl()

ImplPtr System::Net::Sockets::Socket::GetImpl ( ) const

Returns a pointer to implementation.

◆ GetSocketOption() [1/3]

System::SharedPtr<Object> System::Net::Sockets::Socket::GetSocketOption ( SocketOptionLevel  optionLevel,
SocketOptionName  optionName 
)

Returns the value that corresponds to the specified option name.

Parameters
optionLevelThe socket option level.
optionNameThe option name.
Returns
The value that corresponds to the specified option name.

◆ GetSocketOption() [2/3]

System::ArrayPtr<uint8_t> System::Net::Sockets::Socket::GetSocketOption ( SocketOptionLevel  optionLevel,
SocketOptionName  optionName,
int32_t  optionLength 
)

Returns the value that corresponds to the specified option name.

Parameters
optionLevelThe socket option level.
optionNameThe option name.
optionLengthThe option length.
Returns
The value that corresponds to the specified option name.

◆ GetSocketOption() [3/3]

void System::Net::Sockets::Socket::GetSocketOption ( SocketOptionLevel  optionLevel,
SocketOptionName  optionName,
System::ArrayPtr< uint8_t >  optionValue 
)

Gets the value that corresponds to the specified option name.

Parameters
optionLevelThe socket option level.
optionNameThe option name.
optionValueThe output parameter where the corresponding value will be assigned.

◆ IOControl() [1/2]

int32_t System::Net::Sockets::Socket::IOControl ( int32_t  ioControlCode,
System::ArrayPtr< uint8_t >  optionInValue,
System::ArrayPtr< uint8_t >  optionOutValue 
)

Sets low-level operating modes for the socket.

Parameters
ioControlCodeThe control code of the operation to perform.
optionInValueThe byte array that contains the input data.
optionOutValueThe byte array that contains the output data.
Returns
The number of bytes in the optionOutValue parameter.

◆ IOControl() [2/2]

int32_t System::Net::Sockets::Socket::IOControl ( IOControlCode  ioControlCode,
System::ArrayPtr< uint8_t >  optionInValue,
System::ArrayPtr< uint8_t >  optionOutValue 
)

Sets low-level operating modes for the socket.

Parameters
ioControlCodeThe control code of the operation to perform.
optionInValueThe byte array that contains the input data.
optionOutValueThe byte array that contains the output data.
Returns
The number of bytes in the optionOutValue parameter.

◆ Listen()

void System::Net::Sockets::Socket::Listen ( int32_t  backlog)

Changes the socket state to 'listen'.

Parameters
backlogThe maximum number of pending connections.

◆ Poll()

bool System::Net::Sockets::Socket::Poll ( int32_t  microSeconds,
SelectMode  mode 
)

Returns the status of the socket based on the specified polling mode.

Parameters
microSecondsThe amount of time in milliseconds to wait for a response.
modeThe polling mode.
Returns
The status of the socket based on the specified polling mode.

◆ Receive() [1/8]

int32_t System::Net::Sockets::Socket::Receive ( System::ArrayPtr< uint8_t >  buffer)

Receives data from the socket and writes it to the specified byte array.

Parameters
bufferThe byte array where the received data will be assigned.
Returns
The number of received bytes.

◆ Receive() [2/8]

int32_t System::Net::Sockets::Socket::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.

Parameters
bufferThe byte array where the received data will be assigned.
offsetThe offset in bytes in the specified array.
sizeThe number of bytes to receive that will be assigned to the specified byte array from the 'offset' index.
socketFlagsThe receive behaviour.
Returns
The number of received bytes.

◆ Receive() [3/8]

int32_t System::Net::Sockets::Socket::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.

Parameters
bufferThe byte array where the received data will be assigned.
offsetThe offset in bytes in the specified array.
sizeThe number of bytes to receive that will be assigned to the specified byte array from the 'offset' index.
socketFlagsThe receive behaviour.
errorCodeThe output parameter where the error code will be assigned when the receive operation fails.
Returns
The number of received bytes.

◆ Receive() [4/8]

int32_t System::Net::Sockets::Socket::Receive ( System::ArrayPtr< uint8_t >  buffer,
int32_t  size,
SocketFlags  socketFlags 
)

Receives data from the socket and writes it to the specified byte array.

Parameters
bufferThe byte array where the received data will be assigned.
sizeThe number of bytes to receive.
socketFlagsThe receive behaviour.
Returns
The number of received bytes.

◆ Receive() [5/8]

int32_t System::Net::Sockets::Socket::Receive ( System::ArrayPtr< uint8_t >  buffer,
SocketFlags  socketFlags 
)

Receives data from the socket and writes it to the specified byte array.

Parameters
bufferThe byte array where the received data will be assigned.
socketFlagsThe receive behaviour.
Returns
The number of received bytes.

◆ Receive() [6/8]

int32_t System::Net::Sockets::Socket::Receive ( System::SharedPtr< Collections::Generic::IList< ArraySegment< uint8_t >>>  buffers)

Receives data from the socket and writes it to the specified byte arrays.

Parameters
buffersThe byte arrays where the received data will be assigned.
Returns
The number of bytes that are received.

◆ Receive() [7/8]

int32_t System::Net::Sockets::Socket::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.

Parameters
buffersThe byte arrays where the received data will be assigned.
socketFlagsThe receive behaviour.
Returns
The number of received bytes.

◆ Receive() [8/8]

int32_t System::Net::Sockets::Socket::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.

Parameters
buffersThe byte arrays where the received data will be assigned.
socketFlagsThe receive behaviour.
errorCodeThe output parameter where the error code will be assigned when the receive operation fails.
Returns
The number of received bytes.

◆ ReceiveFrom() [1/4]

int32_t System::Net::Sockets::Socket::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.

Parameters
bufferThe byte array where the received data will be assigned.
offsetThe offset in bytes in the specified array.
sizeThe number of bytes to receive that will be assigned to the specified byte array from the 'offset' index.
socketFlagsThe receive behaviour.
remoteEPThe remote endpoint.
Returns
The number of received bytes.

◆ ReceiveFrom() [2/4]

int32_t System::Net::Sockets::Socket::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.

Parameters
bufferThe byte array where the received data will be assigned.
sizeThe number of bytes to receive that will be assigned to the specified byte array from the 'offset' index.
socketFlagsThe receive behaviour.
remoteEPThe remote endpoint.
Returns
The number of received bytes.

◆ ReceiveFrom() [3/4]

int32_t System::Net::Sockets::Socket::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.

Parameters
bufferThe byte array where the received data will be assigned.
socketFlagsThe receive behaviour.
remoteEPThe remote endpoint.
Returns
The number of received bytes.

◆ ReceiveFrom() [4/4]

int32_t System::Net::Sockets::Socket::ReceiveFrom ( System::ArrayPtr< uint8_t >  buffer,
System::SharedPtr< EndPoint > &  remoteEP 
)

Receives data from the specified endpoint and writes it to the specified byte array.

Parameters
bufferThe byte array where the received data will be assigned.
remoteEPThe remote endpoint.
Returns
The number of received bytes.

◆ ReceiveMessageFrom()

int32_t System::Net::Sockets::Socket::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.

Parameters
bufferThe byte array where the received data will be assigned.
offsetThe offset in bytes in the specified array.
sizeThe number of bytes to receive that will be assigned to the specified byte array from the 'offset' index.
socketFlagsThe receive behaviour.
remoteEPThe remote endpoint.
ipPacketInformationThe output parameter where information about the packet will be assigned.
Returns
The number of received bytes.

◆ Send() [1/8]

int32_t System::Net::Sockets::Socket::Send ( System::ArrayPtr< uint8_t >  buffer)

Sends the specified data to the socket.

Parameters
bufferThe data to send.
Returns
The number of sent bytes.

◆ Send() [2/8]

int32_t System::Net::Sockets::Socket::Send ( System::ArrayPtr< uint8_t >  buffer,
int32_t  offset,
int32_t  size,
SocketFlags  socketFlags 
)

Sends the specified data to the socket.

Parameters
bufferThe data to send.
offsetThe offset in bytes in the specified array.
sizeThe number of bytes in the specified array starting from the 'offset' parameter.
socketFlagsThe send behaviour.
Returns
The number of sent bytes.

◆ Send() [3/8]

int32_t System::Net::Sockets::Socket::Send ( System::ArrayPtr< uint8_t >  buffer,
int32_t  offset,
int32_t  size,
SocketFlags  socketFlags,
SocketError errorCode 
)

Sends the specified data to the socket.

Parameters
bufferThe data to send.
offsetThe offset in bytes in the specified array.
sizeThe number of bytes in the specified array starting from the 'offset' parameter.
socketFlagsThe send behaviour.
errorCodeThe output parameter where the error code will be assigned when the send operation fails.
Returns
The number of sent bytes.

◆ Send() [4/8]

int32_t System::Net::Sockets::Socket::Send ( System::ArrayPtr< uint8_t >  buffer,
int32_t  size,
SocketFlags  socketFlags 
)

Sends the specified data to the socket.

Parameters
bufferThe data to send.
sizeThe number of bytes from the specified data that must be send.
socketFlagsThe send behaviour.
Returns
The number of sent bytes.

◆ Send() [5/8]

int32_t System::Net::Sockets::Socket::Send ( System::ArrayPtr< uint8_t >  buffer,
SocketFlags  socketFlags 
)

Sends the specified data to the socket.

Parameters
bufferThe data to send.
socketFlagsThe send behaviour.
Returns
The number of sent bytes.

◆ Send() [6/8]

int32_t System::Net::Sockets::Socket::Send ( System::SharedPtr< Collections::Generic::IList< ArraySegment< uint8_t >>>  buffers)

Sends the specified data to the socket.

Parameters
buffersA collection of byte arrays from which data must be sent.
Returns
The number of sent bytes.

◆ Send() [7/8]

int32_t System::Net::Sockets::Socket::Send ( System::SharedPtr< Collections::Generic::IList< ArraySegment< uint8_t >>>  buffers,
SocketFlags  socketFlags 
)

Sends the specified data to the socket.

Parameters
buffersA collection of byte arrays from which data must be sent.
socketFlagsThe send behaviour.
Returns
The number of sent bytes.

◆ Send() [8/8]

int32_t System::Net::Sockets::Socket::Send ( System::SharedPtr< Collections::Generic::IList< ArraySegment< uint8_t >>>  buffers,
SocketFlags  socketFlags,
SocketError errorCode 
)

Sends the specified data to the socket.

Parameters
buffersA collection of byte arrays from which data must be sent.
socketFlagsThe send behaviour.
errorCodeThe output parameter where the error code will be assigned when the send operation fails.
Returns
The number of sent bytes.

◆ SendTo() [1/4]

int32_t System::Net::Sockets::Socket::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.

Parameters
bufferThe data to send.
offsetThe offset in bytes in the specified array.
sizeThe number of bytes in the specified array starting from the 'offset' parameter.
socketFlagsThe send behaviour.
remoteEPThe remote endpoint.
Returns
The number of sent bytes.

◆ SendTo() [2/4]

int32_t System::Net::Sockets::Socket::SendTo ( System::ArrayPtr< uint8_t >  buffer,
int32_t  size,
SocketFlags  socketFlags,
System::SharedPtr< EndPoint remoteEP 
)

Sends the specified data to the specified endpoint.

Parameters
bufferThe data to send.
sizeThe number of bytes in the specified array.
socketFlagsThe send behaviour.
remoteEPThe remote endpoint.
Returns
The number of sent bytes.

◆ SendTo() [3/4]

int32_t System::Net::Sockets::Socket::SendTo ( System::ArrayPtr< uint8_t >  buffer,
SocketFlags  socketFlags,
System::SharedPtr< EndPoint remoteEP 
)

Sends the specified data to the specified endpoint.

Parameters
bufferThe data to send.
socketFlagsThe send behaviour.
remoteEPThe remote endpoint.
Returns
The number of sent bytes.

◆ SendTo() [4/4]

int32_t System::Net::Sockets::Socket::SendTo ( System::ArrayPtr< uint8_t >  buffer,
System::SharedPtr< EndPoint remoteEP 
)

Sends the specified data to the specified endpoint.

Parameters
bufferThe data to send.
remoteEPThe remote endpoint.
Returns
The number of sent bytes.

◆ set_Blocking()

void System::Net::Sockets::Socket::set_Blocking ( bool  value)

Sets a value that indicates if the socket is in the blocking mode.

Parameters
valueThe value that must be set.

◆ set_ConnectionTimeout()

void System::Net::Sockets::Socket::set_ConnectionTimeout ( int32_t  value)

Sets the connection timeout.

Parameters
valueThe value that must be set.

◆ set_DontFragment()

void System::Net::Sockets::Socket::set_DontFragment ( bool  value)

Sets a value that indicates if the socket allows IP datagrams to be fragmented.

Parameters
valueThe value that must be set.

◆ set_DualMode()

void System::Net::Sockets::Socket::set_DualMode ( bool  value)

Sets a value indicates if the socket is in the dual-mode.

Parameters
valueThe value that must be set.

◆ set_EnableBroadcast()

void System::Net::Sockets::Socket::set_EnableBroadcast ( bool  value)

Sets a value that indicates if the socket allows broadcast packets.

Parameters
valueThe value that must be set.

◆ set_ExclusiveAddressUse()

void System::Net::Sockets::Socket::set_ExclusiveAddressUse ( bool  value)

Sets a value that indicates if only one process can bind the socket to a port.

Parameters
valueThe value that must be set.

◆ set_LingerState()

void System::Net::Sockets::Socket::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.

Parameters
valueThe value that must be set.

◆ set_MulticastLoopback()

void System::Net::Sockets::Socket::set_MulticastLoopback ( bool  value)

Sets a value that indicates if the socket receives outgoing multicast packets.

Parameters
valueThe value that must be set.

◆ set_NoDelay()

void System::Net::Sockets::Socket::set_NoDelay ( bool  value)

Sets a value that indicates if the socket is using the Nagle algorithm.

Parameters
valueThe value that must be set.

◆ set_ReceiveBufferSize()

void System::Net::Sockets::Socket::set_ReceiveBufferSize ( int32_t  value)

Sets the receive buffer size.

Parameters
valueThe value that must be set.

◆ set_ReceiveTimeout()

void System::Net::Sockets::Socket::set_ReceiveTimeout ( int32_t  value)

Sets a period after which a 'Receive' call will time out.

Parameters
valueThe value that must be set.

◆ set_SendBufferSize()

void System::Net::Sockets::Socket::set_SendBufferSize ( int32_t  value)

Sets the send buffer size.

Parameters
valueThe value that must be set.

◆ set_SendTimeout()

void System::Net::Sockets::Socket::set_SendTimeout ( int32_t  value)

Sets a period after which a 'Send' call will time out.

Parameters
valueThe value that must be set.

◆ set_Ttl()

void System::Net::Sockets::Socket::set_Ttl ( int16_t  value)

Sets the TTL value.

Parameters
valueThe value that must be set.

◆ SetSocketOption() [1/4]

void System::Net::Sockets::Socket::SetSocketOption ( SocketOptionLevel  optionLevel,
SocketOptionName  optionName,
bool  optionValue 
)

Sets the specified socket option to the specified value.

Parameters
optionLevelThe socket option level.
optionNameThe name of the option that must be updated.
optionValueThe value that must be set to the specified option.

◆ SetSocketOption() [2/4]

void System::Net::Sockets::Socket::SetSocketOption ( SocketOptionLevel  optionLevel,
SocketOptionName  optionName,
int32_t  optionValue 
)

Sets the specified socket option to the specified value.

Parameters
optionLevelThe socket option level.
optionNameThe name of the option that must be updated.
optionValueThe value that must be set to the specified option.

◆ SetSocketOption() [3/4]

void System::Net::Sockets::Socket::SetSocketOption ( SocketOptionLevel  optionLevel,
SocketOptionName  optionName,
System::ArrayPtr< uint8_t >  optionValue 
)

Sets the specified socket option to the specified value.

Parameters
optionLevelThe socket option level.
optionNameThe name of the option that must be updated.
optionValueThe value that must be set to the specified option.

◆ SetSocketOption() [4/4]

void System::Net::Sockets::Socket::SetSocketOption ( SocketOptionLevel  optionLevel,
SocketOptionName  optionName,
System::SharedPtr< Object optionValue 
)

Sets the specified socket option to the specified value.

Parameters
optionLevelThe socket option level.
optionNameThe name of the option that must be updated.
optionValueThe value that must be set to the specified option.

◆ Shutdown()

void System::Net::Sockets::Socket::Shutdown ( SocketShutdown  how)

Disables the send and receive operations of the socket.

Parameters
howSpecifies the operation that will no longer be allowed.