8.2.1. test/faio/posix-1.01.01

Start felix section to test/faio/posix-1.01.01-0.flx[1 /1 ]
     1: #line 764 "./lpsrc/flx_faio.pak"
     2: #import <flx.flxh>
     3: include "flx_faio_posix";
     4: open Faio_posix;
     5: 
     6: // create a listening socket, spawn a thread to connect to it.
     7: // in case something goes wrong could make test time out with
     8: // spawn_fthread { { sleep 5.0; System::exit 1; }; };
     9: print "felix posix accept/connect test\n";
    10: 
    11: var port = 0;   // let mk_listener choose the port
    12: print "creating listener\n";
    13: var &listener: socket_t <- mk_listener(&port, 1);
    14: 
    15: print "spawning connector\n";
    16: // not printing in thread to make output repeatable in
    17: // the face of scheduler changes.
    18: spawn_fthread{ { var c: socket_t; connect(&c, c"127.0.0.1", port); }; };
    19: 
    20: var s: socket_t;
    21: accept (&s, listener);  // async!
    22: if bad_socket s then {
    23:   System::exit 1;
    24: } else {
    25:   print "accepted connection\n";
    26:   System::exit 0;
    27: } endif;
End felix section to test/faio/posix-1.01.01-0.flx[1]
Start data section to test/faio/posix-1.01.01-0.expect[1 /1 ]
     1: felix posix accept/connect test
     2: creating listener
     3: spawning connector
     4: accepted connection
End data section to test/faio/posix-1.01.01-0.expect[1]