Socket
Contents
[
Hide
]Socket class
The Socket class implements the Berkeley sockets interface.
class Socket : public System::IDisposable
Methods
Method | Description |
---|---|
System::SharedPtr<Socket> Accept() | Creates a new socket for the newly created connection. |
System::SharedPtr<IAsyncResult> BeginConnect(System::SharedPtr<EndPoint>, AsyncCallback, System::SharedPtr<Object>) | Initiates an asynchronous connect operation. |
System::SharedPtr<IAsyncResult> BeginConnect(String, int32_t, AsyncCallback, System::SharedPtr<Object>) | Initiates an asynchronous connect operation. |
System::SharedPtr<IAsyncResult> BeginConnect(System::SharedPtr<IPAddress>, int32_t, AsyncCallback, System::SharedPtr<Object>) | Initiates an asynchronous connect operation. |
System::SharedPtr<IAsyncResult> BeginConnect(System::ArrayPtr<System::SharedPtr<IPAddress>>, int32_t, AsyncCallback, System::SharedPtr<Object>) | Initiates an asynchronous connect operation. |
System::SharedPtr<IAsyncResult> BeginReceive(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags, AsyncCallback, System::SharedPtr<Object>) | Initiates an asynchronous write operation. |
System::SharedPtr<IAsyncResult> BeginSend(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags, AsyncCallback, System::SharedPtr<Object>) | Initiates an asynchronous send operation. |
void Bind(System::SharedPtr<EndPoint>) | Binds the socket with to the specified local endpoint. |
void Close() | Closes the socket connection. |
void Close(int) | Closes the socket connection with the specified timeout to allow queued data to be sent. |
void Connect(System::SharedPtr<EndPoint>) | Establishes a connection to the specified remote endpoint. |
void Connect(System::SharedPtr<IPAddress>, int32_t) | Establishes a connection to the specified remote endpoint. |
void Connect(String, int32_t) | Establishes a connection to the specified remote endpoint. |
void Connect(System::ArrayPtr<System::SharedPtr<IPAddress>>, int32_t) | Establishes a connection to the specified remote endpoint. |
void Dispose() override | Does nothing. |
void EndConnect(System::SharedPtr<IAsyncResult>) | Waits until the specified asynchronous connect operation completes. |
int32_t EndReceive(System::SharedPtr<IAsyncResult>) | Waits until the specified asynchronous receive operation completes. |
int32_t EndReceive(System::SharedPtr<IAsyncResult>, SocketError&) | Waits until the specified asynchronous receive operation completes. |
int32_t EndSend(System::SharedPtr<IAsyncResult>) | Waits until the specified asynchronous send operation completes. |
int32_t EndSend(System::SharedPtr<IAsyncResult>, SocketError&) | Waits until the specified asynchronous send operation completes. |
virtual bool Equals(ptr) | Compares objects using C# Object.Equals semantics. |
static std::enable_if<IsSmartPtr<T1>::value&&IsSmartPtr<T2>::value, bool>::type Equals(T1 const&, T2 const&) | Compares reference type objects in C# style. |
static std::enable_if<!IsSmartPtr<T1>::value&&!IsSmartPtr<T2>::value, bool>::type Equals(T1 const&, T2 const&) | Compares value type objects in C# style. |
static bool Equals(float const&, float const&) | 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. |
static bool Equals(double const&, double const&) | 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. |
virtual bool FastCast(const Details::FastRttiBase&, void **) const | For internal purposes only. |
System::Net::Sockets::AddressFamily get_AddressFamily() | Returns the address family. |
int32_t get_Available() | Gets the number of bytes received from the network and available for reading. |
bool get_Blocking() | Gets a value that indicates if the socket is in the blocking mode. |
bool get_Connected() | Returns a value that indicates if the socket is connected to the remote host. |
bool get_DontFragment() | Gets a value that indicates if the socket allows IP datagrams to be fragmented. |
bool get_DualMode() | Gets a value indicates if the socket is in the dual-mode. |
bool get_EnableBroadcast() | Gets a value that indicates if the socket allows broadcast packets. |
bool get_ExclusiveAddressUse() | Gets a value that indicates if only one process can bind the socket to a port. |
bool get_IsBound() | Returns a value that indicates if the socket is bound to a specific local port. |
System::SharedPtr<LingerOption> get_LingerState() | Gets a value that indicates if the socket will delay closing in an attempt to send all pending data. |
System::SharedPtr<EndPoint> get_LocalEndPoint() | Returns the local endpoint. |
bool get_MulticastLoopback() | Gets a value that indicates if the socket receives outgoing multicast packets. |
bool get_NoDelay() | Gets a value that indicates if the socket is using the Nagle algorithm. |
static bool get_OSSupportsIPv4() | Returns a value that indicates if the operating system and network adaptors support IPv4. |
static bool get_OSSupportsIPv6() | Returns a value that indicates if the operating system and network adaptors support IPv6. |
System::Net::Sockets::ProtocolType get_ProtocolType() | Returns the protocol type. |
int32_t get_ReceiveBufferSize() | Gets the receive buffer size. |
int32_t get_ReceiveTimeout() | Gets a period after which a ‘Receive’ call will time out. |
System::SharedPtr<EndPoint> get_RemoteEndPoint() | Returns the remote endpoint. |
int32_t get_SendBufferSize() | Gets the send buffer size. |
int32_t get_SendTimeout() | Gets a period after which a ‘Send’ call will time out. |
System::Net::Sockets::SocketType get_SocketType() | Returns the socket type. |
static bool get_SupportsIPv4() | Returns a value that indicates if the current host supports IPv4. |
int16_t get_Ttl() | Gets the TTL value. |
Detail::SmartPtrCounter * GetCounter() | Gets reference counter data structure associated with the object. |
virtual int32_t GetHashCode() const | Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. |
ImplPtr GetImpl() const | Returns a pointer to implementation. |
System::SharedPtr<Object> GetSocketOption(SocketOptionLevel, SocketOptionName) | Returns the value that corresponds to the specified option name. |
void GetSocketOption(SocketOptionLevel, SocketOptionName, System::ArrayPtr<uint8_t>) | Gets the value that corresponds to the specified option name. |
System::ArrayPtr<uint8_t> GetSocketOption(SocketOptionLevel, SocketOptionName, int32_t) | Returns the value that corresponds to the specified option name. |
virtual const TypeInfo& GetType() const | Gets actual type of object. Analog of C# System.Object.GetType() call. |
int32_t IOControl(int32_t, System::ArrayPtr<uint8_t>, System::ArrayPtr<uint8_t>) | Sets low-level operating modes for the socket. |
int32_t IOControl(IOControlCode, System::ArrayPtr<uint8_t>, System::ArrayPtr<uint8_t>) | Sets low-level operating modes for the socket. |
virtual bool Is(const TypeInfo&) const | Check if object represents an instance of type described by targetType. Analog of C# ‘is’ operator. |
void Listen(int32_t) | Changes the socket state to ’listen’. |
void Lock() | Implements C# lock() statement locking. Call directly or use LockContext sentry object. |
virtual ptr MemberwiseClone() const | Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. |
Object() | Creates object. Initializes all internal data structures. |
Object(Object const&) | Copy constructor. Doesn’t copy anything, really, just initializes new object and enables copy constructing subclasses. |
Object& operator=(Object const&) | Assignment operator. Doesn’t copy anything, really, just initializes new object and enables copy constructing subclasses. |
bool Poll(int32_t, SelectMode) | Returns the status of the socket based on the specified polling mode. |
int32_t Receive(System::ArrayPtr<uint8_t>, int32_t, SocketFlags) | Receives data from the socket and writes it to the specified byte array. |
int32_t Receive(System::Details::ArrayView<uint8_t>, int32_t, SocketFlags) | Receives data from the socket and writes it to the specified byte array. |
int32_t Receive(System::Details::StackArray<uint8_t, N>&, int32_t, SocketFlags) | Receives data from the socket and writes it to the specified byte array. |
int32_t Receive(System::ArrayPtr<uint8_t>, SocketFlags) | Receives data from the socket and writes it to the specified byte array. |
int32_t Receive(System::Details::ArrayView<uint8_t>, SocketFlags) | Receives data from the socket and writes it to the specified byte array. |
int32_t Receive(System::Details::StackArray<uint8_t, N>&, SocketFlags) | Receives data from the socket and writes it to the specified byte array. |
int32_t Receive(System::ArrayPtr<uint8_t>) | Receives data from the socket and writes it to the specified byte array. |
int32_t Receive(System::Details::ArrayView<uint8_t>) | Receives data from the socket and writes it to the specified byte array. |
int32_t Receive(System::Details::StackArray<uint8_t, N>&) | Receives data from the socket and writes it to the specified byte array. |
int32_t Receive(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags) | Receives data from the socket and writes it to the specified byte array. |
int32_t Receive(System::Details::ArrayView<uint8_t>, int32_t, int32_t, SocketFlags) | Receives data from the socket and writes it to the specified byte array. |
int32_t 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. |
int32_t Receive(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags, SocketError&) | Receives data from the socket and writes it to the specified byte array. |
int32_t 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. |
int32_t 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. |
int32_t Receive(System::SharedPtr<Collections::Generic::IList<ArraySegment<uint8_t>>>) | Receives data from the socket and writes it to the specified byte arrays. |
int32_t Receive(System::SharedPtr<Collections::Generic::IList<ArraySegment<uint8_t>>>, SocketFlags) | Receives data from the socket and writes it to the specified byte arrays. |
int32_t Receive(System::SharedPtr<Collections::Generic::IList<ArraySegment<uint8_t>>>, SocketFlags, SocketError&) | Receives data from the socket and writes it to the specified byte arrays. |
int32_t 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. |
int32_t 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. |
int32_t 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. |
int32_t 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. |
int32_t 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. |
int32_t 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. |
int32_t ReceiveFrom(System::ArrayPtr<uint8_t>, SocketFlags, System::SharedPtr<EndPoint>&) | Receives data from the specified endpoint and writes it to the specified byte array. |
int32_t ReceiveFrom(System::Details::ArrayView<uint8_t>, SocketFlags, System::SharedPtr<EndPoint>&) | Receives data from the specified endpoint and writes it to the specified byte array. |
int32_t ReceiveFrom(System::ArrayPtr<uint8_t>, SocketFlags, System::SharedPtr<EndPoint>&) | Receives data from the specified endpoint and writes it to the specified byte array. |
int32_t ReceiveFrom(System::ArrayPtr<uint8_t>, System::SharedPtr<EndPoint>&) | Receives data from the specified endpoint and writes it to the specified byte array. |
int32_t ReceiveFrom(System::Details::ArrayView<uint8_t>, System::SharedPtr<EndPoint>&) | Receives data from the specified endpoint and writes it to the specified byte array. |
int32_t ReceiveFrom(System::Details::StackArray<uint8_t, N>&, System::SharedPtr<EndPoint>&) | Receives data from the specified endpoint and writes it to the specified byte array. |
int32_t 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. |
int32_t 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. |
int32_t 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. |
static bool ReferenceEquals(ptr const&, ptr const&) | Compares objects by reference. |
static std::enable_if<!IsSmartPtr<T>::value, bool>::type ReferenceEquals(T const&, T const&) | Compares objects by reference. |
static std::enable_if<!IsSmartPtr<T>::value, bool>::type ReferenceEquals(T const&, std::nullptr_t) | Reference-compares value type object with nullptr. |
bool ReferenceEquals(String const&, std::nullptr_t) | Specialization of Object::ReferenceEquals for case of string and nullptr. |
bool ReferenceEquals(String const&, String const&) | Specialization of Object::ReferenceEquals for case of strings. |
int RemovedSharedRefs(int) | Decreases shared reference count by specified value. |
int32_t Send(System::ArrayPtr<uint8_t>, int32_t, SocketFlags) | Sends the specified data to the socket. |
int32_t Send(System::Details::ArrayView<uint8_t>, int32_t, SocketFlags) | Sends the specified data to the socket. |
int32_t Send(System::Details::StackArray<uint8_t, N>&, int32_t, SocketFlags) | Sends the specified data to the socket. |
int32_t Send(System::ArrayPtr<uint8_t>, SocketFlags) | Sends the specified data to the socket. |
int32_t Send(System::Details::ArrayView<uint8_t>, SocketFlags) | Sends the specified data to the socket. |
int32_t Send(System::Details::StackArray<uint8_t, N>&, SocketFlags) | Sends the specified data to the socket. |
int32_t Send(System::ArrayPtr<uint8_t>) | Sends the specified data to the socket. |
int32_t Send(System::Details::ArrayView<uint8_t>) | Sends the specified data to the socket. |
int32_t Send(System::Details::StackArray<uint8_t, N>&) | Sends the specified data to the socket. |
int32_t Send(System::SharedPtr<Collections::Generic::IList<ArraySegment<uint8_t>>>) | Sends the specified data to the socket. |
int32_t Send(System::SharedPtr<Collections::Generic::IList<ArraySegment<uint8_t>>>, SocketFlags) | Sends the specified data to the socket. |
int32_t Send(System::SharedPtr<Collections::Generic::IList<ArraySegment<uint8_t>>>, SocketFlags, SocketError&) | Sends the specified data to the socket. |
int32_t Send(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags) | Sends the specified data to the socket. |
int32_t Send(System::Details::ArrayView<uint8_t>, int32_t, int32_t, SocketFlags) | Sends the specified data to the socket. |
int32_t Send(System::Details::StackArray<uint8_t, N>&, int32_t, int32_t, SocketFlags) | Sends the specified data to the socket. |
int32_t Send(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags, SocketError&) | Sends the specified data to the socket. |
int32_t Send(System::Details::ArrayView<uint8_t>, int32_t, int32_t, SocketFlags, SocketError&) | Sends the specified data to the socket. |
int32_t Send(System::Details::StackArray<uint8_t, N>&, int32_t, int32_t, SocketFlags, SocketError&) | Sends the specified data to the socket. |
int32_t SendTo(System::ArrayPtr<uint8_t>, int32_t, int32_t, SocketFlags, System::SharedPtr<EndPoint>) | Sends the specified data to the specified endpoint. |
int32_t SendTo(System::Details::ArrayView<uint8_t>, int32_t, int32_t, SocketFlags, System::SharedPtr<EndPoint>) | Sends the specified data to the specified endpoint. |
int32_t SendTo(System::Details::StackArray<uint8_t, N>&, int32_t, int32_t, SocketFlags, System::SharedPtr<EndPoint>) | Sends the specified data to the specified endpoint. |
int32_t SendTo(System::ArrayPtr<uint8_t>, int32_t, SocketFlags, System::SharedPtr<EndPoint>) | Sends the specified data to the specified endpoint. |
int32_t SendTo(System::Details::ArrayView<uint8_t>, int32_t, SocketFlags, System::SharedPtr<EndPoint>) | Sends the specified data to the specified endpoint. |
int32_t SendTo(System::Details::StackArray<uint8_t, N>&, int32_t, SocketFlags, System::SharedPtr<EndPoint>) | Sends the specified data to the specified endpoint. |
int32_t SendTo(System::ArrayPtr<uint8_t>, SocketFlags, System::SharedPtr<EndPoint>) | Sends the specified data to the specified endpoint. |
int32_t SendTo(System::Details::ArrayView<uint8_t>, SocketFlags, System::SharedPtr<EndPoint>) | Sends the specified data to the specified endpoint. |
int32_t SendTo(System::Details::StackArray<uint8_t, N>&, SocketFlags, System::SharedPtr<EndPoint>) | Sends the specified data to the specified endpoint. |
int32_t SendTo(System::ArrayPtr<uint8_t>, System::SharedPtr<EndPoint>) | Sends the specified data to the specified endpoint. |
int32_t SendTo(System::Details::ArrayView<uint8_t>, System::SharedPtr<EndPoint>) | Sends the specified data to the specified endpoint. |
int32_t SendTo(System::Details::StackArray<uint8_t, N>&, System::SharedPtr<EndPoint>) | Sends the specified data to the specified endpoint. |
void set_Blocking(bool) | Sets a value that indicates if the socket is in the blocking mode. |
void set_ConnectionTimeout(int32_t) | Sets the connection timeout. |
void set_DontFragment(bool) | Sets a value that indicates if the socket allows IP datagrams to be fragmented. |
void set_DualMode(bool) | Sets a value indicates if the socket is in the dual-mode. |
void set_EnableBroadcast(bool) | Sets a value that indicates if the socket allows broadcast packets. |
void set_ExclusiveAddressUse(bool) | Sets a value that indicates if only one process can bind the socket to a port. |
void set_LingerState(System::SharedPtr<LingerOption>) | Sets a value that indicates if the socket will delay closing in an attempt to send all pending data. |
void set_MulticastLoopback(bool) | Sets a value that indicates if the socket receives outgoing multicast packets. |
void set_NoDelay(bool) | Sets a value that indicates if the socket is using the Nagle algorithm. |
void set_ReceiveBufferSize(int32_t) | Sets the receive buffer size. |
void set_ReceiveTimeout(int32_t) | Sets a period after which a ‘Receive’ call will time out. |
void set_SendBufferSize(int32_t) | Sets the send buffer size. |
void set_SendTimeout(int32_t) | Sets a period after which a ‘Send’ call will time out. |
void set_Ttl(int16_t) | Sets the TTL value. |
void SetSocketOption(SocketOptionLevel, SocketOptionName, int32_t) | Sets the specified socket option to the specified value. |
void SetSocketOption(SocketOptionLevel, SocketOptionName, System::ArrayPtr<uint8_t>) | Sets the specified socket option to the specified value. |
void SetSocketOption(SocketOptionLevel, SocketOptionName, bool) | Sets the specified socket option to the specified value. |
void SetSocketOption(SocketOptionLevel, SocketOptionName, System::SharedPtr<Object>) | Sets the specified socket option to the specified value. |
virtual void SetTemplateWeakPtr(uint32_t) | Set n’th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. |
int SharedCount() const | Gets current value of shared reference counter. |
Object * SharedRefAdded() | Increments shared reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector. |
int SharedRefRemovedSafe() | Decrements and returns shared reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector. |
void 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 String ToString() const | Analog of C# Object.ToString() method. Enables converting custom objects to string. |
static const TypeInfo& Type() | Implements C# typeof(System.Object) construct. |
void Unlock() | Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. |
Detail::SmartPtrCounter * WeakRefAdded() | Increments weak reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector. |
void WeakRefRemoved() | Decrements weak reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector. |
virtual ~Object() | Destroys object. Frees all internal data structures. |
virtual ~Socket() | Destructs the current instance. |
Typedefs
Typedef | Description |
---|---|
ImplPtr | The socket implementation. |
See Also
- Class IDisposable
- Namespace System::Net::Sockets
- Library Aspose.Slides