netReadTCPStream

Reads data from a TCP connection into a buffer. Takes a handle (Int), buffer pointer (Int), and size (Int). Returns the number of bytes read, 0 if no data available, or -1 on error (Int).

Network

Parameters & Returns

Parameters

handle Int
buffer Int
size Int

Returns

Int

Quick Summary

Reads data from a TCP connection into a buffer. Takes a handle (Int), buffer pointer (Int), and size (Int). Returns the number of bytes read, 0 if no data available, or -1 on error (Int).

Technical Exegesis...

Attempts to receive up to 'size' bytes from the TCP stream into the buffer. Returns the number of bytes actually read (may be less than size), 0 if no data is available (WSAEWOULDBLOCK), or -1 on error. The socket is non-blocking, so it returns immediately if no data is available.

Uses recv with the socket handle. The buffer parameter should be a pointer to allocated memory. Returns 0 when no data is pending, not an error condition. Check for -1 to detect connection errors or closure.

Example

Example.bam
; No example implemented yet