Parent

Mongo::SSLSocket

A basic wrapper over Ruby's SSLSocket that initiates a TCP connection over SSL and then provides an basic interface mirroring Ruby's TCPSocket, vis., TCPSocket#send and TCPSocket#read.

Public Class Methods

new(host, port) click to toggle source
# File lib/mongo/util/ssl_socket.rb, line 10
def initialize(host, port)
  @socket = ::TCPSocket.new(host, port)
  @ssl = OpenSSL::SSL::SSLSocket.new(@socket)
  @ssl.sync_close = true
  @ssl.connect
end

Public Instance Methods

close() click to toggle source
# File lib/mongo/util/ssl_socket.rb, line 33
def close
  @ssl.close
end
read(length, buffer) click to toggle source
# File lib/mongo/util/ssl_socket.rb, line 29
def read(length, buffer)
  @ssl.sysread(length, buffer)
end
send(buffer, flags=0) click to toggle source

Write to the SSL socket.

@param buffer a buffer to send. @param flags socket flags. Because Ruby's SSL

# File lib/mongo/util/ssl_socket.rb, line 25
def send(buffer, flags=0)
  @ssl.syswrite(buffer)
end
setsockopt(key, value, n) click to toggle source
# File lib/mongo/util/ssl_socket.rb, line 17
def setsockopt(key, value, n)
  @socket.setsockopt(key, value, n)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.