Filehandles in a socket server

2008-03-10 Thread Jonathan Mast
We have a socket server that, in addition to serving data, also writes logging statements to a file. My question concerns the correctness of how it accesses the log file. The script is running continuously and all the log file IO stuff is inside the main 'while' loop. The file is opened, written

Re: Filehandles in a socket server

2008-03-10 Thread John W. Krahn
Jonathan Mast wrote: We have a socket server that, in addition to serving data, also writes logging statements to a file. My question concerns the correctness of how it accesses the log file. The script is running continuously and all the log file IO stuff is inside the main 'while' loop. The f

Re: Filehandles in a socket server

2008-03-10 Thread Chas. Owens
On Mon, Mar 10, 2008 at 10:08 AM, Jonathan Mast <[EMAIL PROTECTED]> wrote: > We have a socket server that, in addition to serving data, also writes > logging statements to a file. > > My question concerns the correctness of how it accesses the log file. The > script is running continuously and

Re: Filehandles in a socket server

2008-03-10 Thread Rob Dixon
Jonathan Mast wrote: > We have a socket server that, in addition to serving data, also writes logging statements to a file. My question concerns the correctness of how it accesses the log file. The script is running continuously and all the log file IO stuff is inside the main 'while' loop. The

Re: Filehandles in a socket server

2008-03-10 Thread Jonathan Mast
Yeah I'm leaving it alone for now. The socket server receives input episodically and could be invoked thousands of times per minute. But typically it 2 or 3 times per hour. It just seems to be a design flaw to do the repeated open/closing stuff inside the while loop. But something that just cam

Re: Filehandles in a socket server

2008-03-10 Thread Tom Phoenix
On Mon, Mar 10, 2008 at 7:43 AM, Jonathan Mast <[EMAIL PROTECTED]> wrote: > What benefit does flushing have? Would it help prevent memory > leaks as per the above scenario or what? Flushing gets the data out right away, in case there's anybody waiting for it. In the case of log files, it means