netOpenTCPStream

Opens a TCP client connection to a server. Takes an IP address (String) and port (Int). Returns a handle to the connection on success, or 0 on failure (Int).

Network

Parameters & Returns

Parameters

ip String
port Int

Returns

Int

Quick Summary

Opens a TCP client connection to a server. Takes an IP address (String) and port (Int). Returns a handle to the connection on success, or 0 on failure (Int).

Technical Exegesis...

Creates a TCP socket and connects to the specified IP address and port. Returns a handle to the connection on success, or 0 on failure (invalid parameters, socket creation failed, or connection failed). The socket is set to non-blocking mode using ioctlsocket with FIONBIO.

Automatically initializes WinSock 2.2 on first call. Uses AF_INET (IPv4), SOCK_STREAM, and IPPROTO_TCP. IP should be in dotted notation (e.g., "192.168.1.1"). Port must be greater than 0.

Example

Example.bam
; No example implemented yet