void SoftDisconnect() |
Disconnects and disposes the socket if connected and soft disconnects are allowed via HardwareConstants.AllowSoftDisconnects. Sets IsSoftDisconnected = true. |
void SoftConnect() |
Reconnects a soft-disconnected socket. Optionally sends a keepalive reset message to port 8200 if RequiresKeepAliveReset is true. Retries connection up to 3 times on failure. |
void KeepAliveErrorReceived() |
Shuts down, closes, and disposes the socket; fires OnDisconnected event. |
string GetConnectionData() |
Returns a string with local and remote EndPoint information, or empty string on error. |
Socket CreateSock(string connectString, string hostIPAddress) |
Factory method creating a TCP socket with NoDelay, KeepAlive, and custom keepalive timing configured. Optionally binds to hostIPAddress. |
void Create(string connectString) |
Note: Contains a bug (commented-out recursive call). Does nothing. |
void Create(string connectString, string hostIPAddress) |
Creates and configures the internal socket; stores connection parameters. |
void Bind(int port) |
Binds the socket to a local endpoint on the specified port using the first IP address from Dns.GetHostEntry. |
void Listen(int backlog) |
Places the socket in listening state. |
IAsyncResult BeginConnect(AsyncCallback cb, object state) |
Begins an asynchronous connection. Validates socket exists and Connect_String format (host:port). |
void EndConnect(IAsyncResult ar) |
Completes the asynchronous connect operation. |
IAsyncResult BeginDisconnect(bool reuseSocket, AsyncCallback cb, object state) |
Begins asynchronous disconnect. Throws SocketException(WSAEISCONN) if socket is already disconnected. |
void EndDisconnect(IAsyncResult asyncResult) |
Completes the asynchronous disconnect operation. |
IAsyncResult BeginAccept(AsyncCallback callback, object state) |
Begins an asynchronous accept operation. |
IConnection EndAccept(IAsyncResult asyncResult) |
Completes accept and returns a new EthernetConnection wrapping the accepted socket. |
IAsyncResult BeginSend(byte[] buffer, int offset, int size, AsyncCallback cb, object state) |
Begins asynchronous send. Throws if socket is null, callback is null, or socket is not connected. |
int EndSend(IAsyncResult ar) |
Completes the asynchronous send; returns bytes sent. Sets Sock = null on exception. |
Task<int> SendAsync(byte[] sendBuffer, int bufferStartOffset, int bufferSizeToSend) |
Task-based async send wrapper using FromAsync. |
IAsyncResult BeginReceive(byte[] buffer, int offset, int size, AsyncCallback cb, object state) |
Begins asynchronous receive. Throws if socket is null or callback is null. |
int EndReceive(IAsyncResult ar) |
Completes the asynchronous receive; returns bytes received. |
void Dispose() |
Disposes the socket and suppresses finalization. |