2

Teletonika FM1100 first sends the IMEI which you have to respond to by sending an acknowledgment packet 01 to. I can't figure out how i need to send that. It just keeps sending the IMEI because it does not get the 01 in the format it wants it i guess.

Here is a link to the Teletokina protocol documentation PDF http://bit.ly/1OrmI9P (Page 7, Server communication)

This is my code

require 'socket'                # Get sockets from stdlib

server = TCPServer.new 1337   # Socket to listen on port
loop do
  Thread.new(server.accept) do |client|
    client.print "\x00\x01" # also tried "\x01"
    print "#{Time.now.strftime('%d/%m/%Y %H:%M')}: #{client.read} \n"
    client.close
  end
end

I also tried it with client.write and pack in 4 different ways

...
client.write [0x01].pack('C')

client.write [0x00, 0x1].pack('C*')

client.write [0x01].pack('N')

client.write [0x00, 0x1].pack('N*')
...
Drazen
  • 2,776
  • 1
  • 25
  • 39
  • 1
    Possible duplicate of [simplest way to send raw Byte-arrays using Ruby's TCPSocket-Class](http://stackoverflow.com/questions/9326424/simplest-way-to-send-raw-byte-arrays-using-rubys-tcpsocket-class) – georgebrock Feb 23 '16 at 03:40
  • @Drazen I ran into the same problem. How did you solve it? – AutoVit Dec 27 '21 at 16:12
  • I stopped working on the project for other reasons and never got to solving it sorry – Drazen Jan 02 '22 at 17:44

0 Answers0