hs.socket.udp.timeout
hs.socket.udp
objects will be created with this timeout value, but can individually change it with the setTimeout
methodhs.socket.udp.parseAddress(sockaddr) -> table or nil
hs.socket.udp.new([fn]) -> hs.socket.udp object
hs.socket.udp.server(port[, fn]) -> hs.socket.udp object
hs.socket.udp:broadcast([flag]) -> self or nil
true
to enable broadcasting, false
to disable it. Defaults to true
hs.socket.udp:close() -> self
hs.socket.udp
instance for reuse. Any pending send operations are discardedhs.socket.udp:closed() -> bool
true
if closed, otherwise false
hs.socket.udp:connect(host, port[, fn]) -> self or nil
hs.socket.udp:connected() -> bool
true
if connected, otherwise false
hs.socket.udp:enableIPv(version[, flag]) -> self or nil
true
to enable the chosen IP version, false
to disable it. Defaults to true
hs.socket.udp.new(callback):enableIPv(4, false):listen(port):receive()
hs.socket.server
will automatically bind the socket and requires closing and relistening to use this methodhs.socket.udp:info() -> table
string
(sockaddr
struct)string
number
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
string
(sockaddr
struct)string
(sockaddr
struct)string
(sockaddr
struct)string
string
string
number
number
number
number
number
number
string
hs.socket.udp:listen(port) -> self or nil
hs.socket.udp:pause() -> self
hs.socket.udp:preferIPv([version]) -> self
hs.socket.udp:read(delimiter[, tag]) -> self
hs.socket.udp:readOne(delimiter[, tag]) -> self
hs.socket.udp:receive([fn]) -> self or nil
hs.socket.udp:receiveOne([fn]) -> self or nil
hs.socket.udp:reusePort([flag]) -> self or nil
true
to enable port reuse, false
to disable it. Defaults to true
hs.socket.udp:send(message, host, port[, tag][, fn]) -> self
connect
, only the message parameter and an optional tag and/or write callback can be suppliedhs.socket.udp:setBufferSize(size[, version]) -> self
hs.socket.udp:setCallback([fn]) -> self
nil
or no argument clears the callbackhs.socket.udp:setTimeout(timeout) -> self
hs.socket.udp:write(message[, tag]) -> self