1 -----------------------------------------------------------------------------
2 -- TCP sample: Little program to send text lines to a given host/port
3 -- LuaSocket sample files
5 -----------------------------------------------------------------------------
6 local socket
= require("socket")
7 host
= host
or "localhost"
13 print("Attempting connection to host '" ..host
.. "' and port " ..port
.. "...")
14 c
= assert(socket
.connect(host
, port
))
15 print("Connected! Please type stuff (empty line to stop):")
17 while l
and l
~= "" and not e
do
18 assert(c
:send(l
.. "\n"))