netReadTCPString

Receives a string from a TCP connection. Takes a handle (Int) and maximum size (Int). Returns the received data as a string, or empty string if no data available (String).

Network

Parameters & Returns

Parameters

handle Int
maxSize Int

Returns

String

Quick Summary

Receives a string from a TCP connection. Takes a handle (Int) and maximum size (Int). Returns the received data as a string, or empty string if no data available (String).

Technical Exegesis...

Convenience function that receives data from a TCP connection and returns it as a null-terminated string. Allocates a temporary buffer of maxSize+1 bytes, reads up to maxSize bytes using netReadTCPStream, null-terminates the result, and returns the string. Returns an empty string if no data is available.

If maxSize is <= 0, defaults to 1024 bytes. The buffer is automatically freed after copying to the return string. Wrapper around netReadTCPStream for easier string reception.

Example

Example.bam
; No example implemented yet