class SocksTunnel::Local::Connection

Attributes

server[RW]

Public Instance Methods

post_init() click to toggle source
# File lib/socks_tunnel/local.rb, line 16
def post_init
  @coder = Coder.new
  @buffer = Buffer.new
end
receive_data(data) click to toggle source
# File lib/socks_tunnel/local.rb, line 27
def receive_data(data)
  return if data.nil? || data.empty?
  @buffer << data
  @buffer.each do |segment|
    server.send_data(@coder.decode(segment))
  end
end
send_encoded_data(data) click to toggle source
# File lib/socks_tunnel/local.rb, line 21
def send_encoded_data(data)
  return if data.nil? || data.empty?
  send_data(@coder.encode(data))
  send_data(Config.delimiter)
end
unbind() click to toggle source
# File lib/socks_tunnel/local.rb, line 35
def unbind
  server.close_connection_after_writing
end