Class: Bones::RPC::Synchronous::Connection::Socket::SSL

Inherits:
OpenSSL::SSL::SSLSocket
  • Object
show all
Includes:
Connection::Socket::Connectable
Defined in:
lib/bones/rpc/synchronous/connection/socket/ssl.rb

Overview

This is a wrapper around a tcp socket.

Since:

  • 0.0.1

Instance Attribute Summary collapse

Attributes included from Connection::Socket::Connectable

#host, #port

Instance Method Summary collapse

Methods included from Connection::Socket::Connectable

#alive?, included, #read, #readpartial, #write

Constructor Details

#initialize(remote_host, remote_port, local_host = nil, local_port = nil) ⇒ SSL

Initialize the new TCPSocket with SSL.

Examples:

Initialize the socket.

SSL.new("127.0.0.1", 27017)

Parameters:

  • host (String)

    The host.

  • port (Integer)

    The port.

Since:

  • 0.0.1



25
26
27
28
29
30
31
32
33
# File 'lib/bones/rpc/synchronous/connection/socket/ssl.rb', line 25

def initialize(remote_host, remote_port, local_host = nil, local_port = nil)
  @host, @port = remote_host.to_s, remote_port
  handle_socket_errors do
    @socket = TCPSocket.new(@host, remote_port, local_host, local_port)
    super(socket)
    self.sync_close = true
    connect
  end
end

Instance Attribute Details

#socketObject (readonly)

Since:

  • 0.0.1



14
15
16
# File 'lib/bones/rpc/synchronous/connection/socket/ssl.rb', line 14

def socket
  @socket
end

Instance Method Details

#set_encoding(string) ⇒ Object

Set the encoding of the underlying socket.

Parameters:

  • string (String)

    The encoding.

Since:

  • 0.0.1



40
41
42
# File 'lib/bones/rpc/synchronous/connection/socket/ssl.rb', line 40

def set_encoding(string)
  socket.set_encoding(string)
end

#setsockopt(*args) ⇒ Object

Set a socket option on the underlying socket.

Parameters:

  • args (Array<Object>)

    The option arguments.

Since:

  • 0.0.1



49
50
51
# File 'lib/bones/rpc/synchronous/connection/socket/ssl.rb', line 49

def setsockopt(*args)
  socket.setsockopt(*args)
end