You can also use `file-stream-buffer-mode` instead of manually flushing the
port:
https://docs.racket-lang.org/reference/port-buffers.html#(def._((quote._~23~25kernel)._file-stream-buffer-mode))

-Philip


On Thu, Nov 15, 2018 at 2:07 PM Brian Adkins <lojicdot...@gmail.com> wrote:

> That was it - thanks! I guess I was spoiled by Ruby's auto-flushing of
> "puts".
>
> On Thursday, November 15, 2018 at 2:02:07 PM UTC-5, Philippe M wrote:
>>
>> Hi Brian
>>
>> I think you need to add a call to flush-output after sending data to outp
>>
>> Regards
>> Philippe
>>
>>
>> Le jeu. 15 nov. 2018 à 19:51, Brian Adkins <lojic...@gmail.com> a écrit :
>>
>>> I'm porting a Ruby application to Racket (will be deployed on Linux, but
>>> I'm developing on OSX). It uses the s3270 terminal emulator to access a
>>> mainframe. An example in Ruby is:
>>>
>>> IO.popen('s3270 L:ssl3270.example.com:2023', 'r+') do |pipe|
>>>   pipe.puts "ascii"
>>>   puts (pipe.gets)
>>>   puts (pipe.gets)
>>> end
>>>
>>> That issues the "ascii" command, and then reads & displays 2 lines of
>>> output. It seems that Racket's subprocess is a reasonable choice for this,
>>> so I tried the following:
>>>
>>> (define-values (subp inp outp errp)
>>>   (subprocess #f #f #f "/usr/local/bin/s3270" "L:
>>> ssl3270.example.com:2023"))
>>> (displayln "ascii" outp)
>>> (displayln (read-line inp))
>>> (displayln (read-line inp))
>>>
>>> It seems to be connecting to the mainframe because I got a request from
>>> Little Snitch to allow the outbound connection. The s3270 emulator behaves
>>> similar to telnet, if I invoke the command in a shell, the program will
>>> start, then I'll enter ascii and it will display a screenful of lines. I
>>> must be misunderstanding subprocess or the associated IO functions. Any
>>> suggestions?
>>>
>>> Thanks,
>>> Brian
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Racket Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to racket-users...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to