Re: Creating temporary files
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: Creating temporary files

From: Schelte Bron <nospam@wanadoo.nl>
Date: Tue Dec 20 2005 - 13:27:30 CET

On 12/20/05 10:37, opaquay@gillam-fei.be wrote:
> set my_server_socket [socket $server_ip $server_port]
>
> Can i use safely my_server_socket to generate temporary filenames such
> as
>
> file_${my_server_socket}1
> file_${my_server_socket}2
> ...
> file_${my_server_socket}16
>
> and assume that temporary file names for 2 concurent apps won't clash ?
>
At least on Linux there's a very big chance the file names will clash.
The first socket opened by each process (usually) gets a handle of "sock3".

However each process will have to use a different port for connecting to
the server, so you could probably use that as a unique identifier:

set local_port [lindex [fconfigure $my_server_socket -sockname] 2]

Schelte

-- 
set Reply-To [string map {nospam schelte} $header(From)]
Received on Fri Dec 23 19:02:28 2005