repo.or.cz
/
luaevent.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Unlearned get/setMainThread functions since they were unused.
[luaevent.git]
/
test
/
testClient.lua
blob
871207ac5aa0ebc64fbf3f90941c86919ad2c42d
1
require
"luaevent"
2
require
"socket"
3
local
oldPrint
=
print
4
print
=
function
(...)
5
oldPrint
(
"CLT"
, ...)
6
end
7
8
local function
func
()
9
print
(
"ACTIVATED"
)
10
local
sock
=
socket
.
tcp
()
11
--sock:
12
sock
=
luaevent
.
wrap
(
sock
)
13
print
(
assert
(
sock
:
connect
(
"localhost"
,
20000
)))
14
for
i
=
1
,
100
do
assert
(
sock
:
send
(
"Greet me "
))
assert
(
sock
:
receive
(
10
))
collectgarbage
()
end
15
print
(
"COMPLETE"
)
16
end
17
18
luaevent
.
addthread
(
func
)
19
20
luaevent
.
loop
()