#!/bin/sh  
# \
exec oagtclsh "$0" "$@"


set auto_path [linsert $auto_path 0  /usr/local/oag/apps/lib/$env(HOST_ARCH)]
set auto_path [linsert $auto_path 0 /usr/local/oag/lib_patch/$env(HOST_ARCH)]

APSStandardSetup
set args $argv

set filename ""
APSParseArguments { filename}

set errorMessage "Usage: $argv0 -filename <configFile>" 

if {[string length $filename] == 0 } {
    puts stderr $errorMessage
    exit 1
}

set instrumentName 164.54.1.168
set PeerPort 1234

if {[catch {socket $instrumentName $PeerPort} sid]} {
    puts "Error: Socket Could not be created: $sid"
    exit
}

fconfigure $sid -buffering line

puts $sid "*RST"
flush $sid

after 2000
set fh [open $filename r]
while  { [gets $fh string]>0 } {
  #  puts $string
    puts $sid $string
    flush $sid
}
close $fh
close $sid

exit 0
