24 lines
340 B
Lua
24 lines
340 B
Lua
local socket = assert( require 'socket' )
|
|
|
|
local udp = {}
|
|
|
|
local cxn = assert( socket.udp() )
|
|
cxn:settimeout( 0 )
|
|
|
|
function udp.receive()
|
|
return cxn:receive()
|
|
end
|
|
|
|
function udp.connect( ip, port )
|
|
assert( cxn:setpeername( ip, port ) )
|
|
end
|
|
|
|
function udp.disconnect( )
|
|
|
|
end
|
|
|
|
function udp.send( s )
|
|
return cxn:send( s )
|
|
end
|
|
|
|
return udp |