~/bend-docscommunity

wire/wire.bend fails

raw source on the hub · import 0x64e1b9e0466cf913fa57e70aeb11c176/wire/wire.bend as Wire

1 import
import Base

Definitions

def listen source · line 35 · raw

@port:U32 -> IO(Result<&1, &1, Pair(U32, String), Listener>)

def accept source · line 38 · raw

@l:Listener -> IO(Pair(Listener, Result<&1, &1, Pair(U32, String), Socket>))

def connect source · line 41 · raw

@host:String -> @port:U32 -> IO(Result<&1, &1, Pair(U32, String), Socket>)

def close source · line 44 · raw

@sock:Socket -> IO(Unit)

Effects (foreign code)

effect wire_recv source · line 18 · raw

@sock:Socket -> @max:U32 -> IO(Pair(Socket, Result<&1, &1, Pair(U32, String), List<&2, U32>>))

up to max bytes, once some arrive; [] when the peer has closed

foreign: wire/effs/wire.c, wire/effs/wire.js

effect wire_recv_timeout source · line 24 · raw

@sock:Socket -> @max:U32 -> @ms:U32 -> IO(Pair(Socket, Result<&1, &1, Pair(U32, String), Maybe<&1, List<&2, U32>>>))

as wire_recv, but None{} when nothing arrives within ms milliseconds

foreign: wire/effs/wire.c, wire/effs/wire.js

effect wire_send source · line 30 · raw

@sock:Socket -> @data:List<&2, U32> -> IO(Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>))

every byte; a value past 255 fails with EINVAL before any is sent

foreign: wire/effs/wire.c, wire/effs/wire.js