+=end
+def send_md(md_string)
+# puts 'DBG: send_md; md_string.length = '+md_string.length.to_s+'; buffer_size = '+$buffer_size.to_s
+ bs = $buffer_size*2
+ $sp.print("Msg = ")
+ $sp.print(md_string[0])
+ md_string = md_string[1..-1]
+ for i in 0..((md_string.length)/bs)
+# puts 'DBG bulk send'
+ if(md_string.length-i*bs<=bs)
+ # puts "DBG: i="+i.to_s()
+ t = md_string[(i*bs)..-1]
+ printf("sending final %d chars: %s\n", t.length, t[-10..-1]) if $debug
+ $sp.print(t)
+ return
+ end
+ t = md_string[(i*bs)..((i+1)*bs-1)]
+ printf("sending %d chars: %s\n", t.length, t[-10..-1]) if $debug
+ $sp.print(t)
+ sleep(0.1)
+ print("going to wait ... : ") if $debug
+ begin
+ line=$sp.gets()
+ puts(line.inspect) if $debug
+ line='' if !line
+ end while ! /\./.match(line)
+ end
+end
+