mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
socket bind
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user