Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
socket_recv.c File Reference

Implements OP_SOCK_RECV to receive data from a socket into a string. More...

Go to the source code of this file.

Functions

 free_value (maxv)
 free_value (fdv)

Variables

case OP_SOCK_RECV
Value fdv = pop_value(vm)
char * out = NULL
Value s = make_string(out ? out : "")

Detailed Description

Implements OP_SOCK_RECV to receive data from a socket into a string.

Behavior:

  • Pops max_len (int) and fd (int); attempts to read up to max_len bytes; pushes a string with the bytes read.
  • On EOF or error, pushes empty string. Non-UNIX platforms return empty string (unsupported).

Errors:

  • If argument types are wrong, prints an error and pushes empty string.

Definition in file socket_recv.c.

Function Documentation

◆ free_value() [1/2]

free_value(fdv)

◆ free_value() [2/2]

free_value(maxv)

Variable Documentation

◆ fdv

Value fdv = pop_value(vm)

Definition at line 25 of file socket_recv.c.

◆ OP_SOCK_RECV

case OP_SOCK_RECV

Definition at line 22 of file socket_recv.c.

◆ out

char* out = NULL

Definition at line 26 of file socket_recv.c.

◆ s

Value s = make_string(out ? out : "")

Definition at line 52 of file socket_recv.c.