v2.3.2-beta
Wasabi v2.3.2-beta
What's New
TCP Client Support
Wasabi now ships with a full native TCP client alongside the existing WebSocket layer. Both modes share the same connection pool, handle system, proxy infrastructure, and TLS stack — no additional setup required.
Connection
TcpConnect(host, port, outHandle)— plain TCP connection with Happy Eyeballs IPv4/IPv6 racingTcpConnectTLS(host, port, outHandle)— TLS 1.2/1.3 over TCP using the existing SChannel stackTcpDisconnect(handle)— clean teardownTcpIsConnected(handle)— connection state checkTcpGetConnectionCount()— active TCP handle countTcpGetAllHandles()— array of all active TCP handles
I/O
TcpSend(data(), handle)— send raw byte arrayTcpSendText(text, handle)— send UTF-8 encoded stringTcpReceive(handle)— receive available bytes as byte arrayTcpReceiveText(handle)— receive available bytes as UTF-8 stringTcpReceiveUntil(delimiter, timeoutMs, handle)— blocking read until delimiter found or timeout, leftover bytes preserved in buffer for next callTcpFlushBuffer(handle)— discard pending receive bufferTcpGetPendingBytes(handle)— bytes waiting in receive bufferTcpBroadcast(data(), handle)— send byte array to all active TCP handlesTcpBroadcastText(text)— send UTF-8 string to all active TCP handles
Configuration
TcpSetNoDelay(enabled, handle)— toggle Nagle algorithm at any time, even mid-connectionTcpSetInactivityTimeout(timeoutMs, handle)— auto-close connection after period of silenceTcpSetReceiveTimeout(timeoutMs, handle)— per-handle receive timeoutTcpSetBufferSize(bufferSize, handle)— custom receive buffer size (8KB to 16MB)TcpSetPreferIPv6(enabled, handle)— prefer IPv6 in Happy Eyeballs raceTcpSetMTU(mtu, handle)— manual MTU override (576–9000)TcpSetAutoMTU(enabled, handle)— enable/disable automatic MTU discovery via TCP_MAXSEGTcpSetErrorDialog(enabled, handle)— show MsgBox on errorsTcpSetLogCallback(callbackName, handle)— per-handle log routing to VBA procedure
TLS
TcpSetCertValidation(enabled, handle)— enable full server certificate chain validationTcpSetRevocationCheck(enabled, handle)— enable CRL/OCSP revocation checkingTcpSetClientCert(thumbprintOrSubject, handle)— load client certificate from Windows MY storeTcpSetClientCertPfx(pfxPath, pfxPassword, handle)— load client certificate from PFX file
Proxy
TcpSetProxy(host, port, user, pass, type, handle)— HTTP or SOCKS5 proxyTcpClearProxy(handle)— remove proxy configurationTcpAutoDiscoverProxy(handle)— auto-detect system proxy via WinHTTP IE configTcpGetProxyInfo(handle)— proxy configuration summary
Diagnostics & Stats
TcpGetStats(handle)— full stats string: bytes sent/received, messages, uptime, pending bytes, proxy, mode, host, portTcpResetStats(handle)— reset countersTcpGetUptime(handle)— seconds since connection establishedTcpGetLatency(handle)— last measured RTT in msTcpGetMTUInfo(handle)— MTU, MSS, optimal frame sizeTcpGetHost(handle)— connected hostTcpGetPort(handle)— connected portTcpGetMode(handle)— returnsMODE_TCPorMODE_TCP_TLSTcpGetLastError(handle)— lastWasabiErrorenum valueTcpGetLastErrorCode(handle)— last system error codeTcpGetTechnicalDetails(handle)— human-readable error description
Internal Architecture
- New
WasabiConnectionModeenum:MODE_WEBSOCKET,MODE_TCP,MODE_TCP_TLS - New
TcpConnectInternalprivate function extracts pure connection logic shared by all modes ConnectHandlerefactored as a thin wrapper:TcpConnectInternal+ WebSocket handshakeFeedBuffernow branches by connection mode — WebSocket frames go toProcessFrames, TCP raw data goes directly toTcpRecvBufferTickMaintenancenow skips WebSocket-specific ping logic for TCP handlesWebSocketDisconnectandWebSocketDisconnectAllnow mode-aware, TCP handles routed toTcpDisconnectWebSocketGetConnectionCountandWebSocketGetAllHandlesnow filter byMODE_WEBSOCKETonlySafeArrayLenrewritten withoutOn ErrorusingVarPtrArray+CopyMemoryFromPtrto safely detect uninitialized arrays
Validated
Full test suite executed against tcpbin.com:4242 (plain TCP) and example.com:443 (TLS):
| Test | Result |
|---|---|
| Plain TCP connect/disconnect | ✅ 156ms RTT |
| TLS handshake (Cloudflare) | ✅ 125ms, HTTP 200 OK |
| Ping/Echo x5 | ✅ 5/5, avg 156ms RTT |
| Inactivity timeout | ✅ fired at exactly 2000ms |
| TcpReceiveUntil (CrLf, Lf, pipe, timeout) | ✅ all delimiters correct |
| 100-message load test | ✅ 100/100 in 469ms, zero loss |
| 5 simultaneous connections | ✅ all isolated, correct echo per handle |
| NoDelay toggle mid-connection | ✅ applied correctly |
| Reconnection after forced disconnect | ✅ handle reused, echo restored |
| Stats accuracy | ✅ bytes sent/received, messages tracked correctly |