Skip to content

net.unix #

fn close #

fn close(handle int) !

close a socket, given its file descriptor handle.

fn connect_stream #

fn connect_stream(path string) !&StreamConn

fn listen_stream #

fn listen_stream(sock string) !&StreamListener

fn shutdown #

fn shutdown(handle int, config net.ShutdownConfig) int

shutdown shutsdown a socket, given its file descriptor handle.
By default it shuts it down in both directions, both for reading and for writing. You can change that using net.shutdown(handle, how: .read) or net.shutdown(handle, how: .write)

struct StreamConn #

struct StreamConn {
pub mut:
	sock StreamSocket
	write_deadline time.Time
	read_deadline  time.Time
	read_timeout   time.Duration
	write_timeout  time.Duration

fn (StreamConn) close #

fn (mut c StreamConn) close() !

fn (StreamConn) write_ptr #

fn (mut c StreamConn) write_ptr(b &u8, len int) !int

write_ptr blocks and attempts to write all data

fn (StreamConn) write #

fn (mut c StreamConn) write(bytes []u8) !int

write blocks and attempts to write all data

fn (StreamConn) write_string #

fn (mut c StreamConn) write_string(s string) !int

write_string blocks and attempts to write all data

fn (StreamConn) read_ptr #

fn (mut c StreamConn) read_ptr(buf_ptr &u8, len int) !int

fn (StreamConn) read #

fn (mut c StreamConn) read(mut buf []u8) !int

fn (StreamConn) read_deadline #

fn (mut c StreamConn) read_deadline() !time.Time

fn (StreamConn) set_read_deadline #

fn (mut c StreamConn) set_read_deadline(deadline time.Time)

fn (StreamConn) write_deadline #

fn (mut c StreamConn) write_deadline() !time.Time

fn (StreamConn) set_write_deadline #

fn (mut c StreamConn) set_write_deadline(deadline time.Time)

fn (StreamConn) read_timeout #

fn (c &StreamConn) read_timeout() time.Duration

fn (StreamConn) set_read_timeout #

fn (mut c StreamConn) set_read_timeout(t time.Duration)

fn (StreamConn) write_timeout #

fn (c &StreamConn) write_timeout() time.Duration

fn (StreamConn) set_write_timeout #

fn (mut c StreamConn) set_write_timeout(t time.Duration)

fn (StreamConn) wait_for_read #

fn (mut c StreamConn) wait_for_read() !

fn (StreamConn) wait_for_write #

fn (mut c StreamConn) wait_for_write() !

fn (StreamConn) str #

fn (c StreamConn) str() string

struct StreamListener #

struct StreamListener {
pub mut:
	sock StreamSocket
	accept_timeout  time.Duration
	accept_deadline time.Time

fn (StreamListener) accept #

fn (mut l StreamListener) accept() !&StreamConn

fn (StreamListener) accept_deadline #

fn (c &StreamListener) accept_deadline() !time.Time

fn (StreamListener) set_accept_deadline #

fn (mut c StreamListener) set_accept_deadline(deadline time.Time)

fn (StreamListener) accept_timeout #

fn (c &StreamListener) accept_timeout() time.Duration

fn (StreamListener) set_accept_timeout #

fn (mut c StreamListener) set_accept_timeout(t time.Duration)

fn (StreamListener) wait_for_accept #

fn (mut c StreamListener) wait_for_accept() !

fn (StreamListener) close #

fn (mut c StreamListener) close() !

struct StreamSocket #

struct StreamSocket {
	handle int
	path string