Initial revision
This commit is contained in:
parent
6f9d15b660
commit
17c4d1c305
12 changed files with 1777 additions and 0 deletions
25
samples/listener.lua
Normal file
25
samples/listener.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
host = "localhost"
|
||||
port = 8080
|
||||
if arg then
|
||||
host = arg[1] or host
|
||||
port = arg[2] or port
|
||||
end
|
||||
print("Binding to host '" ..host.. "' and port " ..port.. "...")
|
||||
s, i, p, e = bind(host, port)
|
||||
if not s then
|
||||
print(e)
|
||||
exit()
|
||||
end
|
||||
print("Waiting connection from talker on " .. i .. ":" .. p .. "...")
|
||||
c, e = s:accept()
|
||||
if not c then
|
||||
print(e)
|
||||
exit()
|
||||
end
|
||||
print("Connected. Here is the stuff:")
|
||||
l, e = c:receive()
|
||||
while not e do
|
||||
print(l)
|
||||
l, e = c:receive()
|
||||
end
|
||||
print(e)
|
Loading…
Add table
Add a link
Reference in a new issue