.TH socket_sendfile 3 .SH NAME socket_sendfile \- send a file over a TCP socket .SH SYNTAX .B #include int \fBsocket_sendfile\fP(int \fIout\fR, int \fIin\fR, uint32 \fIoffset\fR, uint32 \fIbytes\fR); .SH DESCRIPTION socket_sendfile sends \fIbytes\fR bytes starting at \fIoffset\fR in the file \fIin\fR to the socket connected to file descriptor \fIout\fR. The socket must be connected. Note that the underlying sendfile system call is system specific and currently only implemented on Linux. On other operating systems, it is emulated with a read/write loop. .SH RETURN VALUE socket_sendfile returns 0 if the data was sent successfully. If not, it returns -1 and sets errno appropriately. .SH EXAMPLE #include #include int \fIs\fR; char \fIip\fR[4]; uint16 \fIp\fR; int \fIfd\fR = open_read("/etc/passwd"); \fIs\fR = socket_tcp(); socket_connect4(s,ip,p); socket_sendfile(s,fd,0,23); .SH "SEE ALSO" socket_send6(3)