i am trying to send a file between a client and a server using sockets in C....well i see that there is a function sendfile(), but i donno its usage, can someone guide me with an example how to send a file and receive it.....
It basically copies file data from one file descriptor to another in local machine.
So, not sure if sendfile can be used to transfer file data across network using Socket APIs, but in man page of sendfile a note is mentioned as below,
If you plan to use sendfile() for sending files to a TCP socket, but need to send some header data in front of the file contents, you will find it useful
to employ the TCP_CORK option, described in tcp(7), to minimize the number of packets and to tune performance.
In Linux 2.4 and earlier, out_fd could refer to a regular file, and sendfile() changed the current offset of that file.
So, need to explore these options and try it out....
I wrote a simple prog. to just copy file data from one file to another on same machine.... this shows the usage of sendfile, but you need to modify it further to use it on socket file descriptor. Below is my sample code:
I Developed application in C# with crystal reports and created setup file in third party (Advance) Installer.When i installed my application on client system application is working but ...