netCopyStream

Copies all available data from one TCP stream to another. Takes a source handle (Int), destination handle (Int), and buffer size (Int). Returns the total number of bytes copied (Int).

Network

Parameters & Returns

Parameters

srcHandle Int
destHandle Int
bufferSize Int

Returns

Int

Quick Summary

Copies all available data from one TCP stream to another. Takes a source handle (Int), destination handle (Int), and buffer size (Int). Returns the total number of bytes copied (Int).

Technical Exegesis...

Reads all available data from the source TCP stream and writes it to the destination TCP stream in chunks. Returns the total number of bytes copied. If bufferSize is <= 0, defaults to 1024 bytes.

Uses netCountAvailableBytes to check for data, netReadTCPStream to read, and netWriteTCPStream to write. Loops until no more data is available or an error occurs. Allocates a temporary buffer of bufferSize. Stops on read/write errors or when source has no data. Useful for forwarding/proxying TCP connections.

Example

Example.bam
; No example implemented yet