Capy-Bearer Documentation

socket_write

lib call

Capy

function socket_write(handle : u64, data : string, timeout : s32 = 0) bool

Description

Use socket_write to send data to a socket. true means the complete value was sent, not that the peer processed it. timeout is in seconds. Zero uses the remaining request time budget. The request deadline always applies.

Return Values

true when the write succeeds.

Errors

false reports a failed write, including an invalid handle or timeout. The peer can receive part of the data before failure. The result has no byte count or error message. Retrying the complete value can duplicate data.

Example

Capy

var handle := socket_connect("127.0.0.1", 11211)
if handle != 0 { print(socket_write(handle, "version\r\n"), "\n"); socket_close(handle) }