netCreateTCPServer

Creates a TCP server listening on the specified port. Takes a port (Int). Returns a server handle on success, or 0 on failure (Int).

Network

Parameters & Returns

Parameters

port Int

Returns

Int

Quick Summary

Creates a TCP server listening on the specified port. Takes a port (Int). Returns a server handle on success, or 0 on failure (Int).

Technical Exegesis...

Creates a TCP server socket, binds it to the specified port on all interfaces (INADDR_ANY), and begins listening for incoming connections. Returns a server handle on success, or 0 on failure (invalid port, socket creation failed, bind failed, or listen failed).

Uses AF_INET, SOCK_STREAM, IPPROTO_TCP. Sets SO_REUSEADDR to allow address reuse. Listens with SOMAXCONN maximum pending connections. Socket is set to non-blocking mode. Port must be greater than 0.

Example

Example.bam
; No example implemented yet