Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions vlib/net/udp.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,21 @@ pub fn (mut s UdpSocket) set_dualstack(on bool) ! {
sizeof(int)))!
}

fn (mut s UdpSocket) close() ! {
// close shuts down and closes the socket for communication.
pub fn (mut s UdpSocket) close() ! {
shutdown(s.handle)
return close(s.handle)
}

fn (mut s UdpSocket) select(test Select, timeout time.Duration) !bool {
// select waits for no more than `timeout` for the IO operation, defined by `test`, to be available.
pub fn (mut s UdpSocket) select(test Select, timeout time.Duration) !bool {
return select(s.handle, test, timeout)
}

fn (s &UdpSocket) remote() !Addr {
// remote returns the remote `Addr` address of the socket or `none` if no remote is has been resolved.
pub fn (s &UdpSocket) remote() ?Addr {
if s.has_r {
return s.r
}
return error('none')
return none
}
Loading