Class: Contrast::Api::Communication::TcpSocket
- Includes:
- Socket
- Defined in:
- lib/contrast/api/communication/tcp_socket.rb
Overview
This class allows us to create a TCP Socket to communicate to the Service (Speed Racer). Either it or the Unix Socket will be used, as determined by the configuration options set for Service communication.
Constant Summary
Constants included from Socket
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(host, port) ⇒ TcpSocket
constructor
Create the socket.
- #new_socket ⇒ Object
Methods included from Socket
Constructor Details
#initialize(host, port) ⇒ TcpSocket
Create the socket
20 21 22 23 |
# File 'lib/contrast/api/communication/tcp_socket.rb', line 20 def initialize host, port @host = host.to_s @port = port.to_i end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
15 16 17 |
# File 'lib/contrast/api/communication/tcp_socket.rb', line 15 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
15 16 17 |
# File 'lib/contrast/api/communication/tcp_socket.rb', line 15 def port @port end |
Instance Method Details
#new_socket ⇒ Object
25 26 27 |
# File 'lib/contrast/api/communication/tcp_socket.rb', line 25 def new_socket ::TCPSocket.new(host, port) end |