Sending Content of a file

Sending Content of a file

Post by AMADIU » Thu, 03 Jul 2003 10:53:56



Hello,
How can I a send the content of a file by calling send()?
Right now I am able to send a string; but I want send() to get its input
from a file.

Thanks.

 
 
 

Sending Content of a file

Post by David Schwart » Thu, 03 Jul 2003 11:16:57



Quote:> Hello,
> How can I a send the content of a file by calling send()?
> Right now I am able to send a string; but I want send() to get its input
> from a file.

    The usual way is to 'read' the file (in sensibly-sized chunks if it's
large) and then call 'send' with the data. A better way might be to 'mmap'
this file (in sensibly-sized chunks if it's very large) and then call 'send'
with that memory area (that way, you don't copy the data from the kernel to
user space and then back). An even better way, would be to try calling
'sendfile' and fall back to the other techniques if 'sendfile' fails.

    DS

 
 
 

1. How to send files w/ Content range?

Hi

I'm working on a http-CORBA modul for Apache.
The modul can send files to the client browser. - These files can be
generated on the fly by a CORBA server.
I've seen that programs like Bulletproof FTP send a http request that
tells the server to send only part of the file.
It is useful if you have already downloaded a part of the file but your
connection broke and you don't want to start again from the beginning.
I'd like to do this in the http-CORBA modul. How should I do this? Where
can I fidn information about the protocol used in the http headers?

Thanks in advance

S.T.

  simont.vcf
< 1K Download

2. VMWare

3. Apache 1.3.20: ap_send_http_header() sends Content-Type header when response contains no body

4. Xaw95 in a.out form...

5. Apache not sending Content-type: headers. Why?

6. smail conf problem

7. no "Content-type" sent for CERN proxied FTP URLs?

8. Problems installing linux on a Gateway solo 9100

9. I apologize for my fault that the content of my sent letter to

10. Apache 1.1.1 sends wrong content type

11. How can I send the contents of a buffer to a line printer from C code?

12. I apologize for my fault that the content of my sent letter to

13. how to send argc to function(See content)