| Class | Mongo::Socket |
| In: |
lib/mongo/socket.rb
lib/mongo/socket/ssl.rb lib/mongo/socket/tcp.rb lib/mongo/socket/unix.rb |
| Parent: | Object |
Provides additional data around sockets for the driver‘s use.
@since 2.0.0
| SSL_ERROR | = | 'MongoDB may not be configured with SSL support'.freeze |
Error message for SSL related exceptions.
@since 2.0.0 |
|
| TIMEOUT_ERROR | = | 'Socket request timed out'.freeze |
Error message for timeouts on socket calls.
@since 2.0.0 @deprecated |
|
| TIMEOUT_PACK | = | 'l_2'.freeze |
The pack directive for timeouts.
@since 2.0.0 |
|
| DEFAULT_TCP_KEEPINTVL | = | 10 | ||
| DEFAULT_TCP_KEEPCNT | = | 9 | ||
| DEFAULT_TCP_KEEPIDLE | = | 300 |
| family | [R] | @return [ Integer ] family The type of host family. |
| options | [R] | @return [ Hash ] The options. |
| socket | [R] | @return [ Socket ] socket The wrapped socket. |
Close the socket.
@example Close the socket.
socket.close
@return [ true ] Always true.
@since 2.0.0
Delegates gets to the underlying socket.
@example Get the next line.
socket.gets(10)
@param [ Array<Object> ] args The arguments to pass through.
@return [ Object ] The returned bytes.
@since 2.0.0
Will read all data from the socket for the provided number of bytes. If no data is returned, an exception will be raised.
@example Read all the requested data from the socket.
socket.read(4096)
@param [ Integer ] length The number of bytes to read.
@raise [ Mongo::SocketError ] If not all data is returned.
@return [ Object ] The data from the socket.
@since 2.0.0
Read a single byte from the socket.
@example Read a single byte.
socket.readbyte
@return [ Object ] The read byte.
@since 2.0.0