1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

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

This commit is contained in:
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

View File

@ -259,6 +259,11 @@ fn new_udp_socket_for_remote(raddr Addr) ?&UdpSocket {
return sock 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) ? { pub fn (mut s UdpSocket) set_option_bool(opt SocketOption, value bool) ? {
// TODO reenable when this `in` operation works again // TODO reenable when this `in` operation works again
// if opt !in opts_can_set { // if opt !in opts_can_set {