Class: Sip2::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/sip2/client.rb

Overview

Sip2 Client

Instance Method Summary collapse

Constructor Details

#initialize(host:, port:, ignore_error_detection: false) ⇒ Client

Returns a new instance of Client.



6
7
8
9
10
# File 'lib/sip2/client.rb', line 6

def initialize(host:, port:, ignore_error_detection: false)
  @host = host
  @port = port
  @ignore_error_detection = ignore_error_detection
end

Instance Method Details

#connectObject



12
13
14
15
16
17
18
19
20
# File 'lib/sip2/client.rb', line 12

def connect
  socket = NonBlockingSocket.connect @host, @port
  if block_given?
    connection = Connection.new(socket, @ignore_error_detection)
    yield connection
  end
ensure
  socket.close if socket
end