[Kst] kdeextragear-2/kst/datapush [POSSIBLY UNSAFE]

George Staikos staikos at kde.org
Tue Aug 12 17:11:07 CEST 2003


On Tuesday 12 August 2003 10:58, C. Barth Netterfield wrote:
> Cool!
>
> Do you have examples of 'dirfile' data files to test this on?
> Do you have a test program?  Should I whip one up?

Still working on it.  Essentially it works like this:

datapushd ./myfile.dat

It then listens for arbitrary connections on its port (no access control is 
implemented yet - this is up for discussion).

The incoming connections join in and send:
<somenumber>\n
such as:
42\n

This means that 42 bytes have already been read and cached previous for this 
file, so there is no need to resend them.  0\n is also acceptable.  [Note: 
right now it assumes you are picking up at the end of the file, which is 
wrong because it creates a race.  I need to fix this.]

The server then sends chunks of data as they arrive.  I don't do 
line-buffering in the server because it will slow it down, but it can be done 
if we need to.  I was thinking it's better to do that in the client for 
performance reasons though.

I was also thinking that it would be possible to implement this directly in 
Kst by inheriting from KstFile and making a specialised implementation.  This 
could do caching transparently.

Any thoughts?

Regarding testing: any data file works.  I basically implemented "tail -f" 
with a multiplexed network socket.  My present test client is "telnet 
localhost 4242". :-)

-- 
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/



More information about the Kst mailing list