| Author |
Network application in TK
|
|
| gk_lin@yahoo.com 2005-02-24, 8:59 am |
| Hi
I want to develop a network client /server application. What is
the mechanism to get concurrency in these application. ( eg. I
want my application to listen to some port in the background and at the
same time do some process in the forground.
Thanks
Lin
| |
| antirez 2005-02-24, 8:59 am |
| gk_lin@yahoo.com wrote:
> Hi
>
> I want to develop a network client /server application. What is
> the mechanism to get concurrency in these application. ( eg. I
> want my application to listen to some port in the background and at the
> same time do some process in the forground.
Tcl uses event-driven programming to deal with this problem.
You can find a minimal example of a network application with a gui
(a point to point chat application using Tk) at
http://wiki.tcl.tk/telemaco
Ciao,
Salvatore
| |
| Ron Fox 2005-02-24, 4:01 pm |
| gk_lin@yahoo.com wrote:
> Hi
>
> I want to develop a network client /server application. What is
> the mechanism to get concurrency in these application. ( eg. I
> want my application to listen to some port in the background and at the
> same time do some process in the forground.
>
> Thanks
> Lin
>
The short answer is that after your server proc is called when a
connection is accepted, you establish a fileevent for readability on
that socket (depending on the application level protocol you may also
need to adjust the buffering with fconfigure). This causes a script
(usually a proc) specified in the fileevent command to be called when
the socket has data from the client.
Ron Fox
NSCL
Michigan State University
East Lansing, MI 48824-1321
The life of man is the true romance, which when it is valiantly
conducted, will yield the imagination a higher joy than any fiction. -
Ralph Waldo Emerson
| |
| gk_lin@yahoo.com 2005-02-25, 8:59 am |
| Hello
Thanks for the information. I am a newbie to TCL-TK. Can any one
suggest
a good tutorial for studying the basics and advanced concepts in
TCL-TK. I
have been trying to do some hit and run strategy to do some work. I
like to learn it systematically.
Is wish and TK are the same or different ?
Also where can I get a TCL-TK installation binary for HP-UX
Thanks
Lin
Ron Fox wrote:
> gk_lin@yahoo.com wrote:
>
the[color=darkred]
> The short answer is that after your server proc is called when a
> connection is accepted, you establish a fileevent for readability on
> that socket (depending on the application level protocol you may also
> need to adjust the buffering with fconfigure). This causes a script
> (usually a proc) specified in the fileevent command to be called when
> the socket has data from the client.
>
> Ron Fox
> NSCL
> Michigan State University
> East Lansing, MI 48824-1321
>
> The life of man is the true romance, which when it is valiantly
> conducted, will yield the imagination a higher joy than any fiction.
-
> Ralph Waldo Emerson
| |
| David N. Welton 2005-02-25, 8:59 am |
| gk_lin@yahoo.com writes:
> Thanks for the information. I am a newbie to TCL-TK. Can any one
> suggest a good tutorial for studying the basics and advanced
> concepts in TCL-TK. I have been trying to do some hit and run
> strategy to do some work. I like to learn it systematically.
http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html
> Is wish and TK are the same or different ? Also where can I get
> a TCL-TK installation binary for HP-UX
Tk is the toolkit that does all the graphics stuff. 'wish' is the
name of the executable (as in /usr/bin/wish on Unix, or something
similar) that you use to get that, although these days you can just
do:
package require Tk
and run the whole thing with tclsh.
--
David N. Welton
- http://www.dedasys.com/davidw/
Apache, Linux, Tcl Consulting
- http://www.dedasys.com/
| |
| antirez 2005-02-25, 8:59 am |
| gk_lin@yahoo.com wrote:
> Hello
>
> Thanks for the information. I am a newbie to TCL-TK. Can any one
> suggest
> a good tutorial for studying the basics and advanced concepts in
> TCL-TK.
Another tutorial covering only Tcl is my book Tclwise,
the first 9 chapters are online at http://www.invece.org/tclwise
I think it's a good strategy to learn Tcl basics and
then learn Tk, because to start Tk without a Tcl background
may give the impression that there is a lot of magical content
in Tk, while it's just the Tcl semantic at work.
Ciao,
Salvatore
--
Salvatore Sanfilippo <antirez at invece dot org>
We're programmers. Programmers are, in their hearts, architects -- Joel
Spolsky
http://www.invece.org
| |
| gk_lin@yahoo.com 2005-02-25, 8:59 am |
| Hello
Thanks for the help. I will try to get max out of these tutorials.
In the mean time, I have a program to write where in te gui will be
updated continuasly ( in some interval ) and user should be able to do
some activity in te gui. Basically, it will be a kind of a multi
threaded application. Could I get get some help on how I can achive
this.
Thanks in advance.
Lin
| |
| Cameron Laird 2005-02-25, 8:59 am |
| In article <1109327643.645501.316540@o13g2000cwo.googlegroups.com>,
<gk_lin@yahoo.com> wrote:
>Hello
> Thanks for the help. I will try to get max out of these tutorials.
>
> In the mean time, I have a program to write where in te gui will be
>updated continuasly ( in some interval ) and user should be able to do
>some activity in te gui. Basically, it will be a kind of a multi
>threaded application. Could I get get some help on how I can achive
>this.
| |
| Cameron Laird 2005-02-25, 4:01 pm |
| In article <1109310276.415739.39650@o13g2000cwo.googlegroups.com>,
<gk_lin@yahoo.com> wrote:
|
|
|
|