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

Implements OP_SOCK_TCP_CONNECT to open a TCP connection. More...

Go to the source code of this file.

Functions

 free_value (portv)
 free_value (hostv)
 push_value (vm, make_int(fd > 0 ? fd :0))

Variables

case OP_SOCK_TCP_CONNECT
Value hostv = pop_value(vm)
int fd = 0
 break

Detailed Description

Implements OP_SOCK_TCP_CONNECT to open a TCP connection.

Behavior:

  • Pops port (int) and host (string); attempts to connect and pushes fd (>0) on success or 0 on failure.
  • Name resolution is performed via getaddrinfo; first successful connect wins.

Errors:

  • If argument types are wrong, prints an error and pushes 0.
  • On non-UNIX platforms, returns 0 (unsupported).

Definition in file socket_tcp_connect.c.

Function Documentation

◆ free_value() [1/2]

free_value(hostv)

◆ free_value() [2/2]

free_value(portv)

◆ push_value()

push_value(vm,
make_int(fd > 0 ? fd :0) )

Variable Documentation

◆ break

break

Definition at line 63 of file socket_tcp_connect.c.

◆ fd

int fd = 0

Definition at line 27 of file socket_tcp_connect.c.

◆ hostv

Value hostv = pop_value(vm)

Definition at line 26 of file socket_tcp_connect.c.

◆ OP_SOCK_TCP_CONNECT

case OP_SOCK_TCP_CONNECT

Definition at line 23 of file socket_tcp_connect.c.