net: add UdpSocket.address() method (#13524)

pull/13545/head
gcxfd 2022-02-20 02:45:55 +08:00 committed by GitHub
parent 09f08e1fee
commit dbae2d6af4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -259,6 +259,11 @@ fn new_udp_socket_for_remote(raddr Addr) ?&UdpSocket {
return sock
}
// address gets the address of a socket
pub fn (s &UdpSocket) address() ?Addr {
return addr_from_socket_handle(s.handle)
}
pub fn (mut s UdpSocket) set_option_bool(opt SocketOption, value bool) ? {
// TODO reenable when this `in` operation works again
// if opt !in opts_can_set {