Sha256: c52249300a730b4b8d4867c36b1b5226d47cffdc7064385501a42e5b6705bcc0

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

# rubocop:disable Style/FileName: Use snake_case for source file names.
require 'socket'
require_relative 'LinkSequencer'

server = TCPServer.open('192.168.0.2', 12_777)
puts 'server started'
pinsequencer = OrigenLinkSequencer.new

# time measurements for debug only
# total_receive_time=0
# total_process_time=0
# total_xmit_time=0
# total_close_time=0
# total_packets=0
loop do
  client = server.accept
  # time measurements for debug only
  # t1 = Time.now
  message = client.gets
  # t2 = Time.now
  # process the message
  # for now only pin_ messages are accepted
  response = pinsequencer.processmessage(message.chomp)
  # t3 = Time.now
  client.puts(response)
  # t4 = Time.now
  client.close
  # t5 = Time.now

  # puts "packet process time: #{t3-t2}"
  # total_receive_time += (t2-t1)
  # total_process_time += (t3-t2)
  # total_xmit_time += (t4-t3)
  # total_close_time += (t5-t4)
  # total_packets += 1
  # puts "total receive time: #{total_receive_time}"
  # puts "total process time: #{total_process_time}"
  # puts "total xmit time: #{total_xmit_time}"
  # puts "total close time: #{total_close_time}"
  # puts ''
  # puts "total receive time: #{total_receive_time/total_packets}"
  # puts "total process time: #{total_process_time/total_packets}"
  # puts "total xmit time: #{total_xmit_time/total_packets}"
  # puts "total close time: #{total_close_time/total_packets}"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
origen_link-0.1.0.pre0 lib/origen_link_server/LinkTCPServer.rb