[ back to toc ]

networking in unix

Date: 2002/05/12 19:58

Q:
a client-server model exists.client requests a particular file.server has
to find it and send it's contents.how to find the length of the file and
send the contents character by character?

i am doing a project on designing a proxyserver
using http.give me some tips on woking on files in c in unix.
A:
open the file using fopen. seek to the end using fseek. use the function
tell to get the length.

This way you can know the length of the file. You can read the file using
fread and send it over the net calling send.

Regards,
Peter

[ back to toc ]