non blocking mode for network communications 
Author Message
 non blocking mode for network communications

Hi,

        I encounter some problems with the using of fconfigure.

        It's said on the /doc that for using the non blocking option
        of the network stream, we have to invoke the Tcl_DoOneEvent or
        the vwait instruction.

        Is there anybody who has experimented this ?
        Where can I find examples about all this ?

        Thanks in advance.
        Regards

        Bruno Piscaglia
        Telecommunications and Remote Sensing Laboratory
        Catholic University of Louvain
        Belgium.



Tue, 27 Oct 1998 03:00:00 GMT  
 non blocking mode for network communications

Here is an example of how to connect in nonblocking mode to a telnet server:

        set f [socket remote.host.com telnet]
        fconfigure $f -blocking off

Now you can read from $f without blocking, or you can set it up to call
your procedure when input is available on $f:

        fileevent $f readable [list my_input_proc $f]

If you have further questions, let's take it to one-on-one email.

--JYL

           I encounter some problems with the using of fconfigure.

           It's said on the /doc that for using the non blocking option
           of the network stream, we have to invoke the Tcl_DoOneEvent or
           the vwait instruction.

           Is there anybody who has experimented this ?
           Where can I find examples about all this ?

           Thanks in advance.
           Regards

           Bruno Piscaglia
           Telecommunications and Remote Sensing Laboratory
           Catholic University of Louvain
           Belgium.



Tue, 27 Oct 1998 03:00:00 GMT  
 non blocking mode for network communications

I realized I left out an important piece of information: this will work as
written only in wish or other situations in which Tcl is used in an event
driven manner. If you want to process events in tclsh, the fileevent
command must be followed by a vwait or your code should call update every
so often. For example:

        set f [socket remote.host.com telnet]
        fconfigure $f -blocking off
        proc my_input_proc {f} {
            global wait_var
            set l [gets $f]
            if {[eof $f]} {
                close $f
                set wait_var done
            } else {
                frobify $l
            }
        }
        fileevent $f readable [list my_input_proc $f]
        vwait wait_var

The last vwait is not needed in wish, it is needed in tclsh.

--JYL

   Here is an example of how to connect in nonblocking mode to a telnet server:

           set f [socket remote.host.com telnet]
           fconfigure $f -blocking off

   Now you can read from $f without blocking, or you can set it up to call
   your procedure when input is available on $f:

           fileevent $f readable [list my_input_proc $f]

   If you have further questions, let's take it to one-on-one email.

   --JYL

              I encounter some problems with the using of fconfigure.

              It's said on the /doc that for using the non blocking option
              of the network stream, we have to invoke the Tcl_DoOneEvent or
              the vwait instruction.

              Is there anybody who has experimented this ?
              Where can I find examples about all this ?

              Thanks in advance.
              Regards

              Bruno Piscaglia
              Telecommunications and Remote Sensing Laboratory
              Catholic University of Louvain
              Belgium.



Tue, 27 Oct 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. non-blocking socket communication ?

2. Introduction to non-blocking networking and select()?

3. Non-Blocking Mode?

4. DBD::Oracle9 and non-blocking mode

5. :Oracle9 and non-blocking mode

6. blocking and non-blocking assignment

7. Strange behaviour with blocking and non-blocking assignment

8. blocking/non-blocking

9. Blocking and Non-blocking assignment ?

10. Blocking/Non-Blocking

11. block and non-block?

12. blocking vs non blocking

 

 
Powered by phpBB® Forum Software