Hi,
is it possible to write files via write() to a socket and read it on the other side via read(), without going through buffers? Iif not via write() and read() are there other possibilities?
thanks
darkspace
Hi,
is it possible to write files via write() to a socket and read it on the other side via read(), without going through buffers? Iif not via write() and read() are there other possibilities?
thanks
darkspace
I'm not sure that I understand the question. But you can read() and write() to a socket, however a properly constructed read() or write() call must include the address of a buffer for the data.
Is it possible to use a buffer size of only 1 element? I bet he wants to eliminate any lag related to send/receive with unfilled buffers. I ran into a similiar situation years ago with a bar code reader. I don't remember how I solved the problem (and it was under Win32 anyway).
You can read and write a single byte if you really want to. But sending a byte at a time over a TCP/IP connection is crazy unless you only have a single byte to send. Note that the original question was about sending "files". I think that he wants to send the file straight from disk to the network without the data ever coming into core.
Yeah. Your probably right. I didn't think of it that way.
Exactly, i do not want to store the file into a buffer (for read or write), but write/read it directly from disk to the socket/ from socket to disk.
I got one solution by mapping the file, then i can use the mapped file as the buffer for the read()/write() function.
thanks