For each connection Tcl will create a new channel that may be used to communicate with the client.
but probably these functions itself cannot run at the same time, they will run one after another. but that should be no problem. when you use non-blocking I/O.
Ofloo wrote:no i am asking for global variables so they don't overwrite eachother..
there are no global default variables using [socket -server <port>], or are you asking something else?
if you are going to save the sock# like $::sock you will of course encounter an overwrite of the variable, but luckly you won't need to save it outside the interacting proc, because the proc will be called with the sock# as argument, maybe you should really read The Manual?!
For each connection Tcl will create a new channel that may be used to communicate with the client.
but probably these functions itself cannot run at the same time, they will run one after another. but that should be no problem. when you use non-blocking I/O.
my question is if there will be a new scope for each connection like threads with a parrent its actualy for my webserver in tcl i am asking i can't find the thread on the forum but i once asked how to do code evaluation there did user suggested to use namespaces and a global return variable problem is if sessions do overwrite each other then i can't use global variables like that (not the command global but variable, just saying global variable cause i mean its not local inside the proc)
DragnLord wrote:using the -async switch usually yields the best results with sockets
if you find a better way, please let us know
I guess the only way to find out is to use it for a while.
Variable arrays based on -socketname (if used) may help.
Hard to give advice with not enough info for me to work with.
DragnLord wrote: I guess the only way to find out is to use it for a while.
Variable arrays based on -socketname (if used) may help.
Hard to give advice with not enough info for me to work with.
its not me whom is gone use it so i might find out only months later.. couldn't hurt to ask tho ..
TCL doesn't implement threads - but you can emulate threads using multiple interpeters; there is however the Thread extension which allows you to experience the wonderful pitfalls of multithreaded programming
I highly doubt you need threads to drive your purely event-driven I/O tasks
demond wrote:TCL doesn't implement threads - but you can emulate threads using multiple interpeters; there is however the Thread extension which allows you to experience the wonderful pitfalls of multithreaded programming
I highly doubt you need threads to drive your purely event-driven I/O tasks
just as i expected but i can't say that answers my question.. does socket -server open a new interpreter each time yes or no ? also i sad "like" threads never sad it used em, if it uses multiple sessions i know it would open tclsh just an other time .. thing is does it yes or no ..
so basicly does server socket open a new interpreter which i highly doubt
it also can open a new interpreter without making a new scope like this it could make one scope and multiple threads..
socket -server server 6666
proc server {s i p} {
global somevar
}
for example if the above is the case and 2 connections are made at once will somevar overwrite the data in the other connection ? or will it delay it and finish one at the time ..
Server sockets depend on the Tcl event mechanism to find out when new connections are opened. If the application doesn't enter the event loop, for example by invoking the vwait command or calling the C procedure Tcl_DoOneEvent, then no connections will be accepted.
I'm unsure what exactly your problem is; maybe you need to clarify
If you just need to get a TCL server app to work, check out TCL's wiki for simple examples