Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not 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
992 B

  1. .TH socket_sendfile 3
  2. .SH NAME
  3. socket_sendfile \- send a file over a TCP socket
  4. .SH SYNTAX
  5. .B #include <socket.h>
  6. int \fBsocket_sendfile\fP(int \fIout\fR, int \fIin\fR, uint32 \fIoffset\fR,
  7. uint32 \fIbytes\fR);
  8. .SH DESCRIPTION
  9. socket_sendfile sends \fIbytes\fR bytes starting at \fIoffset\fR in the
  10. file \fIin\fR to the socket connected to file descriptor \fIout\fR.
  11. The socket must be connected.
  12. Note that the underlying sendfile system call is system specific and
  13. currently only implemented on Linux. On other operating systems, it is
  14. emulated with a read/write loop.
  15. .SH RETURN VALUE
  16. socket_sendfile returns 0 if the data was sent successfully. If not,
  17. it returns -1 and sets errno appropriately.
  18. .SH EXAMPLE
  19. #include <socket.h>
  20. #include <open.h>
  21. int \fIs\fR;
  22. char \fIip\fR[4];
  23. uint16 \fIp\fR;
  24. int \fIfd\fR = open_read("/etc/passwd");
  25. \fIs\fR = socket_tcp();
  26. socket_connect4(s,ip,p);
  27. socket_sendfile(s,fd,0,23);
  28. .SH "SEE ALSO"
  29. socket_send6(3)