From 41ee1aae4f0c1fa3ef7d1b9368120ab79a8c7c39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E9=A3=8E?= Date: Tue, 13 Aug 2013 10:42:21 +0800 Subject: [PATCH] socket bind --- lualib/socket.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lualib/socket.lua b/lualib/socket.lua index 2e242591..65065bee 100644 --- a/lualib/socket.lua +++ b/lualib/socket.lua @@ -105,8 +105,8 @@ function socket.open(addr, port) return fd end -function socket.stdin() - local r = skynet.call(sockets, "text", "bind 1") +function socket.bind(sock) + local r = skynet.call(sockets, "text", "bind " .. tonumber(sock)) if r == "" then error("stdin bind failed") end @@ -116,6 +116,10 @@ function socket.stdin() return fd end +function socket.stdin() + return socket.bind(1) +end + function socket.close(fd) socket.lock(fd) skynet.call(sockets, "text", "close", fd)