Class: ExampleInterface

Inherits:
Cosmos::TcpipClientInterface
  • Object
show all
Defined in:
lib/example_interface.rb

Instance Method Summary collapse

Constructor Details

#initialize(hostname, port, write_timeout = 10.0, read_timeout = nil) ⇒ ExampleInterface

Returns a new instance of ExampleInterface.



15
16
17
# File 'lib/example_interface.rb', line 15

def initialize (hostname, port, write_timeout = 10.0, read_timeout = nil)
  super(hostname, port, port, write_timeout, read_timeout, 'LENGTH', 0, 32, 4, 1, 'BIG_ENDIAN', 4)
end

Instance Method Details

#pre_write_packet(packet) ⇒ Object



19
20
21
# File 'lib/example_interface.rb', line 19

def pre_write_packet(packet)
  [packet.length].pack('N') << packet.buffer
end