You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
993 B
Groff
36 lines
993 B
Groff
.TH socket_sendfile 3
|
|
.SH NAME
|
|
socket_sendfile \- send a file over a TCP socket
|
|
.SH SYNTAX
|
|
.B #include <socket.h>
|
|
|
|
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 <socket.h>
|
|
#include <open.h>
|
|
|
|
int \fIs\fR;
|
|
char \fIip\fR[4];
|
|
uint16 \fIp\fR;
|
|
int \fIfd\fR = open_read("/etc/passwd");
|
|
|
|
\fIs\fR = socket_tcp4();
|
|
socket_connect4(s,ip,p);
|
|
socket_sendfile(s,fd,0,23);
|
|
|
|
.SH "SEE ALSO"
|
|
socket_send6(3)
|