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
handleInt
maxSizeInt
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.
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. Useful for text-based protocols and simple string messaging.