netAcceptTCPStream

Accepts a pending client connection from a TCP server. Takes a server handle (Int). Returns a client stream handle on success, 0 if no connection is pending, or -1 on error.

Network

Parameters & Returns

Parameters

serverHandle Int

Returns

Int

Quick Summary

Accepts a pending client connection from a TCP server. Takes a server handle (Int). Returns a client stream handle on success, 0 if no connection is pending, or -1 on error.

Technical Exegesis...

Attempts to accept a pending client connection from the server socket. Returns a client stream handle on success, 0 if no connection is pending (WSAEWOULDBLOCK), or -1 on error. The server is non-blocking, so it returns immediately if no clients are waiting.

Uses accept to get the client socket and sets it to non-blocking mode. The returned handle can be used with netReadTCPStream, netWriteTCPStream, netTCPStreamIP, netTCPStreamPort, and netCloseTCPStream. Check for 0 (no pending connection) vs -1 (error).

Example

Example.bam
; No example implemented yet