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)