~/bend-docscommunity

wire.bend relies on unsafe/foreign

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

Byte-exact TCP, UDP, and TLS sockets.

1 import
import Base

Effects (foreign code)

effect connect source · line 10 · raw

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

TCP connect to an IPv4 address, with a deadline.

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

effect recv source · line 15 · raw

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

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

effect send source · line 20 · raw

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

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

effect recv_from source · line 25 · raw

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

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

effect send_to source · line 30 · raw

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

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

effect tls.connect source · line 37 · raw

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

TLS over a connected TCP socket (OpenSSL 3, loaded at run time; BEND_LIBSSL overrides its path). The certificate chain and host name are always checked.

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

effect tls.send source · line 42 · raw

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

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

effect tls.recv source · line 48 · raw

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

"" once the peer sends close_notify. A bare EOF is an error.

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

effect tls.close source · line 54 · raw

@sock:Socket -> IO(Unit)

Ends the TLS session and closes the socket.

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