Example programming named pipes on MF Acucobol-GT Version 9.1

Hi folks,

I should to build a connection between AcuCobol and Tcl via named pipes on the Windows platform. I have succesfully written a server part and the client part in the Tcl to be sure that the named pipe processing is running okay. Now one part (from case to case as server or client) should run in AcuCobol. In the AcuCobol documentation like "A guide for interoperating with Auccobol", Chapter 6.6.3 there are some sentences like:

"

Named pipes can also be used on Windows systems. You create Windows

pipes with the CreateNamedPipe( ) API. You can then use the CreateFile(

) API to access the other end of the newly created named pipe."

But I had no success with it. So I ask for an example what shows what DLL must be loaded, how to create, connect, write or read the pipe.

The best way with the displaying the actions like my example down.

Thank you very much.

Vaci

#-----------------------------------------------------------------------

      # pips.tcl - test twapi -  named pipe server              

      #-----------------------------------------------------------------------

      # step  action          Tcl                    

      #   1   wish pips.tcl   press Start        create 2 pipes

      #   2                        press Output     send to pipc.tcl

      #   3                        press Input       display from pipc.tcl    

      #----------------------------------------------------------------------

      package require twapi

      set f14     ariel-14

      set f12     ariel-12

      set t        "Test named pipe SERVER unter Windows"

      labelframe  .lf  -text $t          -width   200 \

                       -font $f14        -height  100

      button      .lf.s     -text Start        -command do_start   -font $f12

      button      .lf.i     -text Input        -command do_input   -font $f12

      button      .lf.o     -text Output       -command do_output  -font $f12

      label       .lf.l     -text "sendtime"                       -font $f12

      label       .lf.r     -text "receive "                       -font $f12

      button      .lf.e     -text End          -command do_ende    -font $f12

      pack  .lf.s .lf.i  .lf.o .lf.l .lf.r .lf.e -side left -padx 15

      pack        .lf

      proc do_output {} {

           set     a [expr [clock seconds]]

           puts  $::ou $a

           flush $::ou

           .lf.l configure -text "sended:$a" -bg green

           .lf.r configure                   -bg white

          }

      proc do_getsock {} {

           set msg "kein getsock"

           set msg [getSock]

           .lf.g configure -text $msg -bg yellow

          }

      proc do_input {} {

           if {[gets $::in record] < 0} {

               return

            }

           .lf.r configure -text "received:$record" -bg green

           .lf.l configure                          -bg white

          }

      proc do_start {} {

#          set     a [expr [clock seconds]]

            set    ::npw "\\\\.\\pipe\\CfrT"

            set    ::npr "\\\\.\\pipe\\CtoT"

           .lf configure -text "$::npw $::npr"

           set ::ou [::twapi::namedpipe_server $::npw -access {write}]

           fconfigure $::ou -buffering line -translation crlf -eofchar {} -encoding utf-8

           fileevent    $::ou writable [puts "$::ou writable"]

           .lf configure -text "$::npw $::ou"

           set ::in [::twapi::namedpipe_server $::npr -access {read}]

           fconfigure $::in -buffering line -translation crlf -eofchar {} -encoding utf-8

           fileevent    $::in readable [puts "$::in readable"]

            .lf configure -text "$::npw $::ou $::npr $::in"

   #--------------------------------------------

            pack forget  .lf.s;  # start done

      }

      proc do_ende {} {

           close $::ou

           close $::in

           exit

      }

#ende