Class: ModBus::TCPClient

Inherits:
Client
  • Object
show all
Includes:
TCP
Defined in:
lib/rmodbus/tcp_client.rb

Overview

TCP client implementation

Examples:

TCPClient.connect('127.0.0.1', 502) do |cl|
  cl.with_slave(uid) do |slave|
    slave.holding_registers[0..100]
  end
end

See Also:

Instance Attribute Summary

Attributes included from TCP

#ipaddr, #port

Attributes included from Options

#raise_exception_on_mismatch, #read_retries, #read_retry_timeout

Attributes included from Debug

#logger, #raise_exception_on_mismatch, #read_retries, #read_retry_timeout

Instance Method Summary collapse

Methods included from TCP

#open_tcp_connection

Methods inherited from Client

#close, #closed?, #initialize, #with_slave

Methods included from Debug

#log, #logging_bytes

Constructor Details

This class inherits a constructor from ModBus::Client

Instance Method Details

#get_slave(uid, io) ⇒ Object (protected)



21
22
23
# File 'lib/rmodbus/tcp_client.rb', line 21

def get_slave(uid, io)
  TCPSlave.new(uid, io)
end

#open_connection(ipaddr, port = 502, opts = {}) ⇒ Object (protected)

Open TCPIP connection



17
18
19
# File 'lib/rmodbus/tcp_client.rb', line 17

def open_connection(ipaddr, port = 502, opts = {})
  open_tcp_connection(ipaddr, port, opts)
end