class Bitcourier::Network::Server
Constants
- DEFAULT_PORT
Attributes
port[RW]
Public Class Methods
new(context, port = DEFAULT_PORT)
click to toggle source
# File lib/bitcourier/network/server.rb, line 9 def initialize context, port = DEFAULT_PORT @port = port @context = context end
Public Instance Methods
ip_string()
click to toggle source
# File lib/bitcourier/network/server.rb, line 27 def ip_string end
run()
click to toggle source
# File lib/bitcourier/network/server.rb, line 14 def run @server = TCPServer.new @port puts "Started server on port #{@port}" @thread = Thread.new do loop do socket = @server.accept @context.node_manager.add_socket socket, false end end end