Socket:bind([backlog])
Bind the Socket and listen for incoming connection.
Parameters
backlog
An optional integer representing the maximum length of the queue of pending connections (defaults to 5).
Return value
Returns a boolean value indicating if the operation is successful.Example
-- Echo Server example
local net = require "net"
-- create the server listening Socket
local server = net.Socket("127.0.0.1", 5000)
-- enable server Socket to receive incomming connections
server:bind()
local client = server:accept()
-- echo to the client the data just received
while true do
local data = client:recv()
if data == false then
break
end
client:send(data)
end