class TCPServer

Override stock TCPServer code by encapsulating a Socket instance.

Public Class Methods

new(hostname = nil, port = 0) click to toggle source
# File lib/polyphony/extensions/socket.rb, line 226
def initialize(hostname = nil, port = 0)
  @io = Socket.new Socket::AF_INET, Socket::SOCK_STREAM
  @io.bind(Addrinfo.tcp(hostname, port))
  @io.listen(0)
end

Public Instance Methods

accept() click to toggle source
# File lib/polyphony/extensions/socket.rb, line 233
def accept
  Polyphony.backend_accept(@io, TCPSocket)
  # @io.accept
end
Also aliased as: orig_accept
accept_loop(&block) click to toggle source
# File lib/polyphony/extensions/socket.rb, line 238
def accept_loop(&block)
  Polyphony.backend_accept_loop(@io, TCPSocket, &block)
end
close() click to toggle source
# File lib/polyphony/extensions/socket.rb, line 243
def close
  @io.close
end
Also aliased as: orig_close
orig_accept()
Alias for: accept
orig_close()
Alias for: close