Skip to content

v2.3.2-beta

Choose a tag to compare

@uesleibros uesleibros released this 06 May 00:43
· 299 commits to main since this release
e069ac0

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 racing
  • TcpConnectTLS(host, port, outHandle) — TLS 1.2/1.3 over TCP using the existing SChannel stack
  • TcpDisconnect(handle) — clean teardown
  • TcpIsConnected(handle) — connection state check
  • TcpGetConnectionCount() — active TCP handle count
  • TcpGetAllHandles() — array of all active TCP handles
I/O
  • TcpSend(data(), handle) — send raw byte array
  • TcpSendText(text, handle) — send UTF-8 encoded string
  • TcpReceive(handle) — receive available bytes as byte array
  • TcpReceiveText(handle) — receive available bytes as UTF-8 string
  • TcpReceiveUntil(delimiter, timeoutMs, handle) — blocking read until delimiter found or timeout, leftover bytes preserved in buffer for next call
  • TcpFlushBuffer(handle) — discard pending receive buffer
  • TcpGetPendingBytes(handle) — bytes waiting in receive buffer
  • TcpBroadcast(data(), handle) — send byte array to all active TCP handles
  • TcpBroadcastText(text) — send UTF-8 string to all active TCP handles
Configuration
  • TcpSetNoDelay(enabled, handle) — toggle Nagle algorithm at any time, even mid-connection
  • TcpSetInactivityTimeout(timeoutMs, handle) — auto-close connection after period of silence
  • TcpSetReceiveTimeout(timeoutMs, handle) — per-handle receive timeout
  • TcpSetBufferSize(bufferSize, handle) — custom receive buffer size (8KB to 16MB)
  • TcpSetPreferIPv6(enabled, handle) — prefer IPv6 in Happy Eyeballs race
  • TcpSetMTU(mtu, handle) — manual MTU override (576–9000)
  • TcpSetAutoMTU(enabled, handle) — enable/disable automatic MTU discovery via TCP_MAXSEG
  • TcpSetErrorDialog(enabled, handle) — show MsgBox on errors
  • TcpSetLogCallback(callbackName, handle) — per-handle log routing to VBA procedure
TLS
  • TcpSetCertValidation(enabled, handle) — enable full server certificate chain validation
  • TcpSetRevocationCheck(enabled, handle) — enable CRL/OCSP revocation checking
  • TcpSetClientCert(thumbprintOrSubject, handle) — load client certificate from Windows MY store
  • TcpSetClientCertPfx(pfxPath, pfxPassword, handle) — load client certificate from PFX file
Proxy
  • TcpSetProxy(host, port, user, pass, type, handle) — HTTP or SOCKS5 proxy
  • TcpClearProxy(handle) — remove proxy configuration
  • TcpAutoDiscoverProxy(handle) — auto-detect system proxy via WinHTTP IE config
  • TcpGetProxyInfo(handle) — proxy configuration summary
Diagnostics & Stats
  • TcpGetStats(handle) — full stats string: bytes sent/received, messages, uptime, pending bytes, proxy, mode, host, port
  • TcpResetStats(handle) — reset counters
  • TcpGetUptime(handle) — seconds since connection established
  • TcpGetLatency(handle) — last measured RTT in ms
  • TcpGetMTUInfo(handle) — MTU, MSS, optimal frame size
  • TcpGetHost(handle) — connected host
  • TcpGetPort(handle) — connected port
  • TcpGetMode(handle) — returns MODE_TCP or MODE_TCP_TLS
  • TcpGetLastError(handle) — last WasabiError enum value
  • TcpGetLastErrorCode(handle) — last system error code
  • TcpGetTechnicalDetails(handle) — human-readable error description

Internal Architecture

  • New WasabiConnectionMode enum: MODE_WEBSOCKET, MODE_TCP, MODE_TCP_TLS
  • New TcpConnectInternal private function extracts pure connection logic shared by all modes
  • ConnectHandle refactored as a thin wrapper: TcpConnectInternal + WebSocket handshake
  • FeedBuffer now branches by connection mode — WebSocket frames go to ProcessFrames, TCP raw data goes directly to TcpRecvBuffer
  • TickMaintenance now skips WebSocket-specific ping logic for TCP handles
  • WebSocketDisconnect and WebSocketDisconnectAll now mode-aware, TCP handles routed to TcpDisconnect
  • WebSocketGetConnectionCount and WebSocketGetAllHandles now filter by MODE_WEBSOCKET only
  • SafeArrayLen rewritten without On Error using VarPtrArray + CopyMemoryFromPtr to 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