Class: Mongo::Socket::TCP Private
- Inherits:
-
Mongo::Socket
- Object
- Mongo::Socket
- Mongo::Socket::TCP
- Defined in:
- build/ruby-driver-v2.19/lib/mongo/socket/tcp.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Wrapper for TCP sockets.
Constant Summary
Constants inherited from Mongo::Socket
SSL_ERROR, TIMEOUT_ERROR, TIMEOUT_PACK, WRITE_CHUNK_SIZE
Instance Attribute Summary collapse
-
#host ⇒ String
readonly
private
Host The host to connect to.
-
#port ⇒ Integer
readonly
private
Port The port to connect to.
Attributes inherited from Mongo::Socket
#family, #options, #socket, #timeout
Instance Method Summary collapse
-
#initialize(host, port, timeout, family, options = {}) ⇒ TCP
constructor
private
Initializes a new TCP socket.
Methods inherited from Mongo::Socket
#alive?, #close, #connectable?, #connection_address, #connection_generation, #eof?, #gets, #monitor?, #read, #readbyte, #summary, #write
Constructor Details
#initialize(host, port, timeout, family, options = {}) ⇒ TCP
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes a new TCP socket.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'build/ruby-driver-v2.19/lib/mongo/socket/tcp.rb', line 48 def initialize(host, port, timeout, family, = {}) if family.nil? raise ArgumentError, 'family must be specified' end super(timeout, ) @host, @port = host, port @family = family @socket = ::Socket.new(family, SOCK_STREAM, 0) begin (@socket) connect! rescue @socket.close raise end end |
Instance Attribute Details
#host ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns host The host to connect to.
66 67 68 |
# File 'build/ruby-driver-v2.19/lib/mongo/socket/tcp.rb', line 66 def host @host end |
#port ⇒ Integer (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns port The port to connect to.
69 70 71 |
# File 'build/ruby-driver-v2.19/lib/mongo/socket/tcp.rb', line 69 def port @port end |