accept

socket.accept => [client_socket, client_addrinfo]
Instance Public methods

Accepts a next connection. Returns a new Socket object and Addrinfo object.

serv = Socket.new(:INET, :STREAM, 0)
serv.listen(5)
c = Socket.new(:INET, :STREAM, 0)
c.connect(serv.connect_address)
p serv.accept #=> [#<Socket:fd 6>, #<Addrinfo: 127.0.0.1:48555 TCP>]
doc_ruby_on_rails
2015-05-15 07:09:30
Comments
Leave a Comment

Please login to continue.