aboutsummaryrefslogtreecommitdiff
path: root/samples/talker.lua
blob: b3313e60b17f9ca5e7ad4c9923919f9b540079b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
host = "localhost"
port = 8080
if arg then
	host = arg[1] or host
	port = arg[2] or port
end
print("Attempting connection to host '" ..host.. "' and port " ..port.. "...")
c, e = connect(host, port)
if not c then
	print(e)
	exit()
end
print("Connected! Please type stuff (empty line to stop):")
l = read()
while l and l ~= "" and not e do
	e = c:send(l, "\n")
	if e then
		print(e)
		exit()
	end
	l = read()
end