socket bind

This commit is contained in:
云风
2013-08-13 10:42:21 +08:00
parent a897d87e88
commit 41ee1aae4f

View File

@@ -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)