Optimizing frequent file transfer?

Hi

I have written a simple client/server(socket programming) application using TCP/IP. My server code runs on Linux and client is on windows. The concept is that the client request for files(on demand basis) to the server and the server sends it back to the client. As the client is attached to a graphics application, it demands the files as much frequent as possible (the frequency at which the files are requested is so high).

Actually, at server side, I am reading the requested file into a buffer and the buffer is sent through the socket using read() and write calls. My network bandwidth is 10Mbps.

I am not getting sufficient speed to my frequency of file reading which in turn causes my graphics application less interactive. Could u suggest something to increase the speed my transaction??

Thanks

Is there a time gap between requesting for the file and rendering as a graphical application? In that case, you could try asynchronous calls there by caching the data or prefetching the data before being actually used or requested.

There is no fixed gap between the file requests. It depends on how fast the user interacts with the graphical scene. And, as it is upto the user(at client side) where he would like to view the area/scene on overall graphics, it s not predictable to prefetch the file appropriate for scene.

One more thing is that I will get the file detail the moment he focus the area he likes. Then only I am making request to the server for the file.

Could sendfile() be good solution for this???

Depending on the distance between server and client location, you might have to try local caching, storing the fetched data in a local cache, ( shared cache is needed? ) if there is a miss and use the cache data to display in graphics if that is a hit ( where data needed can be fetched from the local cache instead of server ) and data access can be greatly reduced! Just a thought.