From 0f6c8d50a99997ac7829864b1c93362b50f1bbf3 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Sun, 25 May 2003 01:54:13 +0000 Subject: Porting to LUA 5.0 final --- samples/daytimeclnt.lua | 3 ++- samples/talker.lua | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'samples') diff --git a/samples/daytimeclnt.lua b/samples/daytimeclnt.lua index 000dfd5..4debc81 100644 --- a/samples/daytimeclnt.lua +++ b/samples/daytimeclnt.lua @@ -7,7 +7,8 @@ end host = socket.toip(host) udp = socket.udp() print("Using host '" ..host.. "' and port " ..port.. "...") -err = udp:sendto("anything", host, port) +udp:setpeername(host, port) +sent, err = udp:send("anything") if err then print(err) exit() end dgram, err = udp:receive() if not dgram then print(err) exit() end diff --git a/samples/talker.lua b/samples/talker.lua index d66cf66..688824f 100644 --- a/samples/talker.lua +++ b/samples/talker.lua @@ -5,18 +5,18 @@ if arg then port = arg[2] or port end print("Attempting connection to host '" ..host.. "' and port " ..port.. "...") -c, e = connect(host, port) +c, e = socket.connect(host, port) if not c then print(e) - exit() + os.exit() end print("Connected! Please type stuff (empty line to stop):") -l = read() +l = io.read() while l and l ~= "" and not e do - e = c:send(l, "\n") + t, e = c:send(l, "\n") if e then print(e) - exit() + os.exit() end - l = read() + l = io.read() end -- cgit v1.2.3-55-g6feb