System::Net::Sockets::Socket class

Socket class

The Socket class implements the Berkeley sockets interface.

class Socket : public System::IDisposable

Methods

MethodDescription
Accept()Creates a new socket for the newly created connection.
BeginConnect(System::SharedPtr<EndPoint>, AsyncCallback, System::SharedPtr<Object>)Initiates an asynchronous connect operation.
BeginConnect(String, int32_t, AsyncCallback, System::SharedPtr<Object>)Initiates an asynchronous connect operation.
BeginConnect(System::SharedPtr<IPAddress>, int32_t, AsyncCallback, System::SharedPtr<Object>)Initiates an asynchronous connect operation.
BeginConnect(System::ArrayPtr<System::SharedPtr<IPAddress>>, int32_t, AsyncCallback, System::SharedPtr<Object>)Initiates an asynchronous connect operation.
BeginReceive(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags, AsyncCallback, System::SharedPtr<Object>)Initiates an asynchronous write operation.
BeginSend(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags, AsyncCallback, System::SharedPtr<Object>)Initiates an asynchronous send operation.
Bind(System::SharedPtr<EndPoint>)Binds the socket with to the specified local endpoint.
Close()Closes the socket connection.
Close(int)Closes the socket connection with the specified timeout to allow queued data to be sent.
Connect(System::SharedPtr<EndPoint>)Establishes a connection to the specified remote endpoint.
Connect(System::SharedPtr<IPAddress>, int32_t)Establishes a connection to the specified remote endpoint.
Connect(String, int32_t)Establishes a connection to the specified remote endpoint.
Connect(System::ArrayPtr<System::SharedPtr<IPAddress>>, int32_t)Establishes a connection to the specified remote endpoint.
Dispose() overrideDoes nothing.
EndConnect(System::SharedPtr<IAsyncResult>)Waits until the specified asynchronous connect operation completes.
EndReceive(System::SharedPtr<IAsyncResult>)Waits until the specified asynchronous receive operation completes.
EndReceive(System::SharedPtr<IAsyncResult>, SocketError&)Waits until the specified asynchronous receive operation completes.
EndSend(System::SharedPtr<IAsyncResult>)Waits until the specified asynchronous send operation completes.
EndSend(System::SharedPtr<IAsyncResult>, SocketError&)Waits until the specified asynchronous send operation completes.
get_AddressFamily()Returns the address family.
get_Available()Gets the number of bytes received from the network and available for reading.
get_Blocking()Gets a value that indicates if the socket is in the blocking mode.
get_Connected()Returns a value that indicates if the socket is connected to the remote host.
get_DontFragment()Gets a value that indicates if the socket allows IP datagrams to be fragmented.
get_DualMode()Gets a value indicates if the socket is in the dual-mode.
get_EnableBroadcast()Gets a value that indicates if the socket allows broadcast packets.
get_ExclusiveAddressUse()Gets a value that indicates if only one process can bind the socket to a port.
get_IsBound()Returns a value that indicates if the socket is bound to a specific local port.
get_LingerState()Gets a value that indicates if the socket will delay closing in an attempt to send all pending data.
get_LocalEndPoint()Returns the local endpoint.
get_MulticastLoopback()Gets a value that indicates if the socket receives outgoing multicast packets.
get_NoDelay()Gets a value that indicates if the socket is using the Nagle algorithm.
static get_OSSupportsIPv4()Returns a value that indicates if the operating system and network adaptors support IPv4.
static get_OSSupportsIPv6()Returns a value that indicates if the operating system and network adaptors support IPv6.
get_ProtocolType()Returns the protocol type.
get_ReceiveBufferSize()Gets the receive buffer size.
get_ReceiveTimeout()Gets a period after which a ‘Receive’ call will time out.
get_RemoteEndPoint()Returns the remote endpoint.
get_SendBufferSize()Gets the send buffer size.
get_SendTimeout()Gets a period after which a ‘Send’ call will time out.
get_SocketType()Returns the socket type.
static get_SupportsIPv4()RTTI information.
get_Ttl()Gets the TTL value.
GetImpl() constReturns a pointer to implementation.
GetSocketOption(SocketOptionLevel, SocketOptionName)Returns the value that corresponds to the specified option name.
GetSocketOption(SocketOptionLevel, SocketOptionName, System::ArrayPtr<uint8_t>)Gets the value that corresponds to the specified option name.
GetSocketOption(SocketOptionLevel, SocketOptionName, int32_t)Returns the value that corresponds to the specified option name.
IOControl(int32_t, System::ArrayPtr<uint8_t>, System::ArrayPtr<uint8_t>)Sets low-level operating modes for the socket.
IOControl(IOControlCode, System::ArrayPtr<uint8_t>, System::ArrayPtr<uint8_t>)Sets low-level operating modes for the socket.
Listen(int32_t)Changes the socket state to ’listen’.
Poll(int32_t, SelectMode)Returns the status of the socket based on the specified polling mode.
Receive(System::ArrayPtr<uint8_t>, int32_t, SocketFlags)Receives data from the socket and writes it to the specified byte array.
Receive(System::Details::ArrayView<uint8_t>, int32_t, SocketFlags)Receives data from the socket and writes it to the specified byte array.
Receive(System::Details::StackArray<uint8_t, N>&, int32_t, SocketFlags)Receives data from the socket and writes it to the specified byte array.
Receive(System::ArrayPtr<uint8_t>, SocketFlags)Receives data from the socket and writes it to the specified byte array.
Receive(System::Details::ArrayView<uint8_t>, SocketFlags)Receives data from the socket and writes it to the specified byte array.
Receive(System::Details::StackArray<uint8_t, N>&, SocketFlags)Receives data from the socket and writes it to the specified byte array.
Receive(System::ArrayPtr<uint8_t>)Receives data from the socket and writes it to the specified byte array.
Receive(System::Details::ArrayView<uint8_t>)Receives data from the socket and writes it to the specified byte array.
Receive(System::Details::StackArray<uint8_t, N>&)Receives data from the socket and writes it to the specified byte array.
Receive(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags)Receives data from the socket and writes it to the specified byte array.
Receive(System::Details::ArrayView<uint8_t>, int32_t, int32_t, SocketFlags)Receives data from the socket and writes it to the specified byte array.
Receive(System::Details::StackArray<uint8_t, N>&, int32_t, int32_t, SocketFlags)Receives data from the socket and writes it to the specified byte array.
Receive(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags, SocketError&)Receives data from the socket and writes it to the specified byte array.
Receive(System::Details::ArrayView<uint8_t>, int32_t, int32_t, SocketFlags, SocketError&)Receives data from the socket and writes it to the specified byte array.
Receive(System::Details::StackArray<uint8_t, N>&, int32_t, int32_t, SocketFlags, SocketError&)Receives data from the socket and writes it to the specified byte array.
Receive(System::SharedPtr<Collections::Generic::IList<ArraySegment<uint8_t>>>)Receives data from the socket and writes it to the specified byte arrays.
Receive(System::SharedPtr<Collections::Generic::IList<ArraySegment<uint8_t>>>, SocketFlags)Receives data from the socket and writes it to the specified byte arrays.
Receive(System::SharedPtr<Collections::Generic::IList<ArraySegment<uint8_t>>>, SocketFlags, SocketError&)Receives data from the socket and writes it to the specified byte arrays.
ReceiveFrom(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags, System::SharedPtr<EndPoint>&)Receives data from the specified endpoint and writes it to the specified byte array.
ReceiveFrom(System::Details::ArrayView<uint8_t>, int32_t, int32_t, SocketFlags, System::SharedPtr<EndPoint>&)Receives data from the specified endpoint and writes it to the specified byte array.
ReceiveFrom(System::Details::StackArray<uint8_t, N>&, int32_t, int32_t, SocketFlags, System::SharedPtr<EndPoint>&)Receives data from the specified endpoint and writes it to the specified byte array.
ReceiveFrom(System::ArrayPtr<uint8_t>, int32_t, SocketFlags, System::SharedPtr<EndPoint>&)Receives data from the specified endpoint and writes it to the specified byte array.
ReceiveFrom(System::Details::ArrayView<uint8_t>, int32_t, SocketFlags, System::SharedPtr<EndPoint>&)Receives data from the specified endpoint and writes it to the specified byte array.
ReceiveFrom(System::Details::StackArray<uint8_t, N>&, int32_t, SocketFlags, System::SharedPtr<EndPoint>&)Receives data from the specified endpoint and writes it to the specified byte array.
ReceiveFrom(System::ArrayPtr<uint8_t>, SocketFlags, System::SharedPtr<EndPoint>&)Receives data from the specified endpoint and writes it to the specified byte array.
ReceiveFrom(System::Details::ArrayView<uint8_t>, SocketFlags, System::SharedPtr<EndPoint>&)Receives data from the specified endpoint and writes it to the specified byte array.
ReceiveFrom(System::ArrayPtr<uint8_t>, SocketFlags, System::SharedPtr<EndPoint>&)Receives data from the specified endpoint and writes it to the specified byte array.
ReceiveFrom(System::ArrayPtr<uint8_t>, System::SharedPtr<EndPoint>&)Receives data from the specified endpoint and writes it to the specified byte array.
ReceiveFrom(System::Details::ArrayView<uint8_t>, System::SharedPtr<EndPoint>&)Receives data from the specified endpoint and writes it to the specified byte array.
ReceiveFrom(System::Details::StackArray<uint8_t, N>&, System::SharedPtr<EndPoint>&)Receives data from the specified endpoint and writes it to the specified byte array.
ReceiveMessageFrom(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags&, System::SharedPtr<EndPoint>&, IPPacketInformation&)Receives data from the specified endpoint and writes it to the specified byte array.
ReceiveMessageFrom(System::Details::ArrayView<uint8_t>, int32_t, int32_t, SocketFlags&, System::SharedPtr<EndPoint>&, IPPacketInformation&)Receives data from the specified endpoint and writes it to the specified byte array.
ReceiveMessageFrom(System::Details::StackArray<uint8_t, N>&, int32_t, int32_t, SocketFlags&, System::SharedPtr<EndPoint>&, IPPacketInformation&)Receives data from the specified endpoint and writes it to the specified byte array.
Send(System::ArrayPtr<uint8_t>, int32_t, SocketFlags)Sends the specified data to the socket.
Send(System::Details::ArrayView<uint8_t>, int32_t, SocketFlags)Sends the specified data to the socket.
Send(System::Details::StackArray<uint8_t, N>&, int32_t, SocketFlags)Sends the specified data to the socket.
Send(System::ArrayPtr<uint8_t>, SocketFlags)Sends the specified data to the socket.
Send(System::Details::ArrayView<uint8_t>, SocketFlags)Sends the specified data to the socket.
Send(System::Details::StackArray<uint8_t, N>&, SocketFlags)Sends the specified data to the socket.
Send(System::ArrayPtr<uint8_t>)Sends the specified data to the socket.
Send(System::Details::ArrayView<uint8_t>)Sends the specified data to the socket.
Send(System::Details::StackArray<uint8_t, N>&)Sends the specified data to the socket.
Send(System::SharedPtr<Collections::Generic::IList<ArraySegment<uint8_t>>>)Sends the specified data to the socket.
Send(System::SharedPtr<Collections::Generic::IList<ArraySegment<uint8_t>>>, SocketFlags)Sends the specified data to the socket.
Send(System::SharedPtr<Collections::Generic::IList<ArraySegment<uint8_t>>>, SocketFlags, SocketError&)Sends the specified data to the socket.
Send(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags)Sends the specified data to the socket.
Send(System::Details::ArrayView<uint8_t>, int32_t, int32_t, SocketFlags)Sends the specified data to the socket.
Send(System::Details::StackArray<uint8_t, N>&, int32_t, int32_t, SocketFlags)Sends the specified data to the socket.
Send(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags, SocketError&)Sends the specified data to the socket.
Send(System::Details::ArrayView<uint8_t>, int32_t, int32_t, SocketFlags, SocketError&)Sends the specified data to the socket.
Send(System::Details::StackArray<uint8_t, N>&, int32_t, int32_t, SocketFlags, SocketError&)Sends the specified data to the socket.
SendTo(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags, System::SharedPtr<EndPoint>)Sends the specified data to the specified endpoint.
SendTo(System::Details::ArrayView<uint8_t>, int32_t, int32_t, SocketFlags, System::SharedPtr<EndPoint>)Sends the specified data to the specified endpoint.
SendTo(System::Details::StackArray<uint8_t, N>&, int32_t, int32_t, SocketFlags, System::SharedPtr<EndPoint>)Sends the specified data to the specified endpoint.
SendTo(System::ArrayPtr<uint8_t>, int32_t, SocketFlags, System::SharedPtr<EndPoint>)Sends the specified data to the specified endpoint.
SendTo(System::Details::ArrayView<uint8_t>, int32_t, SocketFlags, System::SharedPtr<EndPoint>)Sends the specified data to the specified endpoint.
SendTo(System::Details::StackArray<uint8_t, N>&, int32_t, SocketFlags, System::SharedPtr<EndPoint>)Sends the specified data to the specified endpoint.
SendTo(System::ArrayPtr<uint8_t>, SocketFlags, System::SharedPtr<EndPoint>)Sends the specified data to the specified endpoint.
SendTo(System::Details::ArrayView<uint8_t>, SocketFlags, System::SharedPtr<EndPoint>)Sends the specified data to the specified endpoint.
SendTo(System::Details::StackArray<uint8_t, N>&, SocketFlags, System::SharedPtr<EndPoint>)Sends the specified data to the specified endpoint.
SendTo(System::ArrayPtr<uint8_t>, System::SharedPtr<EndPoint>)Sends the specified data to the specified endpoint.
SendTo(System::Details::ArrayView<uint8_t>, System::SharedPtr<EndPoint>)Sends the specified data to the specified endpoint.
SendTo(System::Details::StackArray<uint8_t, N>&, System::SharedPtr<EndPoint>)Sends the specified data to the specified endpoint.
set_Blocking(bool)Sets a value that indicates if the socket is in the blocking mode.
set_ConnectionTimeout(int32_t)Sets the connection timeout.
set_DontFragment(bool)Sets a value that indicates if the socket allows IP datagrams to be fragmented.
set_DualMode(bool)Sets a value indicates if the socket is in the dual-mode.
set_EnableBroadcast(bool)Sets a value that indicates if the socket allows broadcast packets.
set_ExclusiveAddressUse(bool)Sets a value that indicates if only one process can bind the socket to a port.
set_LingerState(System::SharedPtr<LingerOption>)Sets a value that indicates if the socket will delay closing in an attempt to send all pending data.
set_MulticastLoopback(bool)Sets a value that indicates if the socket receives outgoing multicast packets.
set_NoDelay(bool)Sets a value that indicates if the socket is using the Nagle algorithm.
set_ReceiveBufferSize(int32_t)Sets the receive buffer size.
set_ReceiveTimeout(int32_t)Sets a period after which a ‘Receive’ call will time out.
set_SendBufferSize(int32_t)Sets the send buffer size.
set_SendTimeout(int32_t)Sets a period after which a ‘Send’ call will time out.
set_Ttl(int16_t)Sets the TTL value.
SetSocketOption(SocketOptionLevel, SocketOptionName, int32_t)Sets the specified socket option to the specified value.
SetSocketOption(SocketOptionLevel, SocketOptionName, System::ArrayPtr<uint8_t>)Sets the specified socket option to the specified value.
SetSocketOption(SocketOptionLevel, SocketOptionName, bool)Sets the specified socket option to the specified value.
SetSocketOption(SocketOptionLevel, SocketOptionName, System::SharedPtr<Object>)Sets the specified socket option to the specified value.
Shutdown(SocketShutdown)Disables the send and receive operations of the socket.
Socket(System::Net::Sockets::SocketType, System::Net::Sockets::ProtocolType)Constructs a new instance.
Socket(System::Net::Sockets::AddressFamily, System::Net::Sockets::SocketType, System::Net::Sockets::ProtocolType)Constructs a new instance.
virtual ~Socket()Destructs the current instance.

Typedefs

TypedefDescription
ImplPtrThe socket implementation.

See Also