Class: Mongo::Socket::TCP
- Inherits:
-
Mongo::Socket
- Object
- Mongo::Socket
- Mongo::Socket::TCP
- Defined in:
- lib/mongo/socket/tcp.rb
Overview
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
Host The host to connect to.
-
#port ⇒ Integer
readonly
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
Initializes a new TCP socket.
Methods inherited from Mongo::Socket
#alive?, #close, #connectable?, #eof?, #gets, #read, #readbyte, #write
Constructor Details
#initialize(host, port, timeout, family, options = {}) ⇒ TCP
Initializes a new TCP socket.
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/mongo/socket/tcp.rb', line 66 def initialize(host, port, timeout, family, = {}) @host, @port, @timeout, @options = host, port, timeout, @family = family @socket = ::Socket.new(family, SOCK_STREAM, 0) begin (@socket) connect! rescue @socket.close raise end end |
Instance Attribute Details
#host ⇒ String (readonly)
Returns host The host to connect to.
24 25 26 |
# File 'lib/mongo/socket/tcp.rb', line 24 def host @host end |
#port ⇒ Integer (readonly)
Returns port The port to connect to.
27 28 29 |
# File 'lib/mongo/socket/tcp.rb', line 27 def port @port end |