init
This commit is contained in:
42
docs/ai/Common/DTS.CommonCore/Interface/Connection.md
Normal file
42
docs/ai/Common/DTS.CommonCore/Interface/Connection.md
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.CommonCore/Interface/Connection/IConnection.cs
|
||||
generated_at: "2026-04-17T16:08:23.342605+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "c423b632187ca2f1"
|
||||
---
|
||||
|
||||
# Connection
|
||||
|
||||
### Purpose
|
||||
This module defines the `IConnection` interface, which provides an abstraction layer for network socket connections. It supports both synchronous and asynchronous communication patterns, connection lifecycle management (including a "soft disconnect" state for temporary disconnections with reconnection intent), and server-side operations like binding and listening. The interface extends `IDisposable` to ensure proper resource cleanup.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**Interface: `IConnection`** (extends `IDisposable`)
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `SendAsync` | `Task<int> SendAsync(byte[] sendBuffer, int bufferStartOffset, int bufferSizeToSend)` | Asynchronously sends data from the buffer. Returns the number of bytes sent. |
|
||||
| `IsSoftDisconnected` | `bool IsSoftDisconnected { get; }` | Returns `true` if the unit is soft disconnected (voluntarily disconnected with expectation of reconnecting). |
|
||||
| `SoftDisconnect` | `void SoftDisconnect()` | Performs a soft disconnect (voluntary disconnect with intention to reconnect later). |
|
||||
| `SoftConnect` | `void SoftConnect()` | Reconnects a soft disconnected unit. |
|
||||
| `Flags` | `System.Net.Sockets.SocketFlags Flags { get; set; }` | Gets or sets socket flags for send/receive operations. |
|
||||
| `OnDisconnected` | `event EventHandler OnDisconnected` | Event raised when the connection is disconnected. |
|
||||
| `KeepAliveErrorReceived` | `void KeepAliveErrorReceived()` | Called to indicate the device has not received a timely response to keep-alive. |
|
||||
| `ConnectString` | `string ConnectString { get; }` | Gets the connection string for this connection. |
|
||||
| `Connected` | `bool Connected { get; }` | Gets whether the connection is currently active. |
|
||||
| `Create` | `void Create(string connectString)` | Initializes the connection with a connection string. |
|
||||
| `Create` | `void Create(string connectString, string hostIPAddress)` | Initializes the connection with a connection string and specific host IP address. |
|
||||
| `GetConnectionData` | `string GetConnectionData()` | Retrieves connection data as a string. |
|
||||
| `BeginConnect` | `IAsyncResult BeginConnect(AsyncCallback callback, object callbackObject)` | Begins an asynchronous connection attempt. |
|
||||
| `EndConnect` | `void EndConnect(IAsyncResult ar)` | Completes an asynchronous connection attempt. |
|
||||
| `BeginDisconnect` | `IAsyncResult BeginDisconnect(bool reuseSocket, AsyncCallback callback, object state)` | Begins an asynchronous disconnection. |
|
||||
| `EndDisconnect` | `void EndDisconnect(IAsyncResult asyncResult)` | Completes an asynchronous disconnection. |
|
||||
| `BeginAccept` | `IAsyncResult BeginAccept(AsyncCallback callback, object state)` | Begins an asynchronous operation to accept an incoming connection. |
|
||||
| `EndAccept` | `IConnection EndAccept(IAsyncResult asyncResult)` | Completes an accept operation and returns the accepted `IConnection`. |
|
||||
| `Bind` | `void Bind(int port)` | Binds the connection to a specific local port. |
|
||||
| `Listen` | `void Listen(int backlog)` | Places the connection in a listening state with specified backlog. |
|
||||
| `BeginSend` | `IAsyncResult BeginSend(byte[] sendBuffer, int bufferStartOffset, int bufferSizeToSend, AsyncCallback callback, object callbackObject)` | Begins an asynchronous send operation. |
|
||||
| `End
|
||||
Reference in New Issue
Block a user